Home | History | Annotate | Download | only in browser
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_VALIDATION_MESSAGE_MESSAGE_FILTER_H_
      6 #define CHROME_BROWSER_VALIDATION_MESSAGE_MESSAGE_FILTER_H_
      7 
      8 #include "content/public/browser/browser_message_filter.h"
      9 
     10 namespace chrome {
     11 class ValidationMessageBubble;
     12 }
     13 
     14 namespace gfx {
     15 class Rect;
     16 }
     17 
     18 // A message filter implementation that receives validation message requests
     19 // from ValidationMessageAgent.
     20 class ValidationMessageMessageFilter : public content::BrowserMessageFilter {
     21  public:
     22   explicit ValidationMessageMessageFilter(int renderer_id);
     23 
     24   // content::BrowserMessageFilter implementation.
     25   virtual bool OnMessageReceived(const IPC::Message& message,
     26                                  bool* message_was_ok) OVERRIDE;
     27   virtual void OverrideThreadForMessage(
     28       const IPC::Message& message, content::BrowserThread::ID* thread) OVERRIDE;
     29 
     30  private:
     31   virtual ~ValidationMessageMessageFilter();
     32   void OnShowValidationMessage(int route_id,
     33                                const gfx::Rect& anchor_in_root_view,
     34                                const string16& main_text,
     35                                const string16& sub_text);
     36   void OnHideValidationMessage();
     37   void OnMoveValidationMessage(int route_id,
     38                                const gfx::Rect& anchor_in_root_view);
     39 
     40   scoped_ptr<chrome::ValidationMessageBubble> validation_message_bubble_;
     41   int renderer_id_;
     42 
     43   DISALLOW_COPY_AND_ASSIGN(ValidationMessageMessageFilter);
     44 };
     45 
     46 #endif  // CHROME_BROWSER_VALIDATION_MESSAGE_MESSAGE_FILTER_H_
     47