Home | History | Annotate | Download | only in webui
      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_UI_WEBUI_THEME_HANDLER_H_
      6 #define CHROME_BROWSER_UI_WEBUI_THEME_HANDLER_H_
      7 
      8 #include "content/public/browser/notification_observer.h"
      9 #include "content/public/browser/notification_registrar.h"
     10 #include "content/public/browser/web_ui_message_handler.h"
     11 
     12 class Profile;
     13 
     14 namespace content {
     15 class WebUI;
     16 }
     17 
     18 // A class to keep the ThemeSource up to date when theme changes.
     19 class ThemeHandler : public content::WebUIMessageHandler,
     20                      public content::NotificationObserver {
     21  public:
     22   explicit ThemeHandler();
     23   virtual ~ThemeHandler();
     24 
     25  private:
     26   // content::WebUIMessageHandler implementation.
     27   virtual void RegisterMessages() OVERRIDE;
     28 
     29   // Re/set the CSS caches.
     30   void InitializeCSSCaches();
     31 
     32   // content::NotificationObserver implementation.
     33   virtual void Observe(int type,
     34                        const content::NotificationSource& source,
     35                        const content::NotificationDetails& details) OVERRIDE;
     36 
     37   Profile* GetProfile() const;
     38 
     39   content::NotificationRegistrar registrar_;
     40 
     41   DISALLOW_COPY_AND_ASSIGN(ThemeHandler);
     42 };
     43 
     44 #endif  // CHROME_BROWSER_UI_WEBUI_THEME_HANDLER_H_
     45