| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/scoped_observer.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/profiles/profile.h" | |
| 13 #include "content/public/browser/notification_observer.h" | |
| 14 #include "content/public/browser/notification_registrar.h" | |
| 15 #include "content/public/browser/web_ui_controller.h" | 12 #include "content/public/browser/web_ui_controller.h" |
| 13 #include "extensions/browser/extension_registry_observer.h" |
| 14 |
| 15 namespace content { |
| 16 class BrowserContext; |
| 17 } |
| 18 |
| 19 namespace extensions { |
| 20 class ExtensionRegistry; |
| 21 } |
| 16 | 22 |
| 17 // The WebUI class for the uber page (chrome://chrome). It manages the UI for | 23 // The WebUI class for the uber page (chrome://chrome). It manages the UI for |
| 18 // the uber page (navigation bar and so forth) as well as WebUI objects for | 24 // the uber page (navigation bar and so forth) as well as WebUI objects for |
| 19 // pages that appear in the uber page. | 25 // pages that appear in the uber page. |
| 20 class UberUI : public content::WebUIController { | 26 class UberUI : public content::WebUIController { |
| 21 public: | 27 public: |
| 22 explicit UberUI(content::WebUI* web_ui); | 28 explicit UberUI(content::WebUI* web_ui); |
| 23 ~UberUI() override; | 29 ~UberUI() override; |
| 24 | 30 |
| 25 content::WebUI* GetSubpage(const std::string& page_url); | 31 content::WebUI* GetSubpage(const std::string& page_url); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 // Creates and stores a WebUI for the given URL. | 46 // Creates and stores a WebUI for the given URL. |
| 41 void RegisterSubpage(const std::string& page_url, | 47 void RegisterSubpage(const std::string& page_url, |
| 42 const std::string& page_host); | 48 const std::string& page_host); |
| 43 | 49 |
| 44 // The WebUI*s in this map are owned. | 50 // The WebUI*s in this map are owned. |
| 45 SubpageMap sub_uis_; | 51 SubpageMap sub_uis_; |
| 46 | 52 |
| 47 DISALLOW_COPY_AND_ASSIGN(UberUI); | 53 DISALLOW_COPY_AND_ASSIGN(UberUI); |
| 48 }; | 54 }; |
| 49 | 55 |
| 50 class UberFrameUI : public content::NotificationObserver, | 56 class UberFrameUI : public content::WebUIController, |
| 51 public content::WebUIController { | 57 public extensions::ExtensionRegistryObserver { |
| 52 public: | 58 public: |
| 53 explicit UberFrameUI(content::WebUI* web_ui); | 59 explicit UberFrameUI(content::WebUI* web_ui); |
| 54 ~UberFrameUI() override; | 60 ~UberFrameUI() override; |
| 55 | 61 |
| 56 private: | 62 private: |
| 57 // content::NotificationObserver implementation. | 63 // extensions::ExtensionRegistryObserver implementation. |
| 58 void Observe(int type, | 64 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 59 const content::NotificationSource& source, | 65 const extensions::Extension* extension) override; |
| 60 const content::NotificationDetails& details) override; | 66 void OnExtensionUnloaded( |
| 67 content::BrowserContext* browser_context, |
| 68 const extensions::Extension* extension, |
| 69 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 61 | 70 |
| 62 content::NotificationRegistrar registrar_; | 71 ScopedObserver<extensions::ExtensionRegistry, |
| 72 extensions::ExtensionRegistryObserver> |
| 73 extension_registry_observer_; |
| 63 | 74 |
| 64 DISALLOW_COPY_AND_ASSIGN(UberFrameUI); | 75 DISALLOW_COPY_AND_ASSIGN(UberFrameUI); |
| 65 }; | 76 }; |
| 66 | 77 |
| 67 #endif // CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ | 78 #endif // CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ |
| OLD | NEW |