| 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/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/scoped_observer.h" | |
| 12 #include "base/values.h" | 11 #include "base/values.h" |
| 13 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 14 #include "content/public/browser/web_ui_controller.h" | 13 #include "content/public/browser/web_ui_controller.h" |
| 15 #include "extensions/browser/extension_registry_observer.h" | |
| 16 | |
| 17 namespace content { | |
| 18 class BrowserContext; | |
| 19 } | |
| 20 | |
| 21 namespace extensions { | |
| 22 class ExtensionRegistry; | |
| 23 } | |
| 24 | 14 |
| 25 // Logs visits to subframe URLs (e.g. chrome://settings-frame). | 15 // Logs visits to subframe URLs (e.g. chrome://settings-frame). |
| 26 class SubframeLogger : public content::WebContentsObserver { | 16 class SubframeLogger : public content::WebContentsObserver { |
| 27 public: | 17 public: |
| 28 explicit SubframeLogger(content::WebContents* contents); | 18 explicit SubframeLogger(content::WebContents* contents); |
| 29 ~SubframeLogger() override; | 19 ~SubframeLogger() override; |
| 30 | 20 |
| 31 // content::WebContentsObserver implementation. | 21 // content::WebContentsObserver implementation. |
| 32 void DidFinishNavigation( | 22 void DidFinishNavigation( |
| 33 content::NavigationHandle* navigation_handle) override; | 23 content::NavigationHandle* navigation_handle) override; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 60 const std::string& page_host); | 50 const std::string& page_host); |
| 61 | 51 |
| 62 std::unique_ptr<SubframeLogger> subframe_logger_; | 52 std::unique_ptr<SubframeLogger> subframe_logger_; |
| 63 | 53 |
| 64 // Map from URL origin to WebUI instance. | 54 // Map from URL origin to WebUI instance. |
| 65 std::map<std::string, std::unique_ptr<content::WebUI>> sub_uis_; | 55 std::map<std::string, std::unique_ptr<content::WebUI>> sub_uis_; |
| 66 | 56 |
| 67 DISALLOW_COPY_AND_ASSIGN(UberUI); | 57 DISALLOW_COPY_AND_ASSIGN(UberUI); |
| 68 }; | 58 }; |
| 69 | 59 |
| 70 class UberFrameUI : public content::WebUIController, | 60 class UberFrameUI : public content::WebUIController { |
| 71 public extensions::ExtensionRegistryObserver { | |
| 72 public: | 61 public: |
| 73 explicit UberFrameUI(content::WebUI* web_ui); | 62 explicit UberFrameUI(content::WebUI* web_ui); |
| 74 ~UberFrameUI() override; | 63 ~UberFrameUI() override; |
| 75 | |
| 76 private: | |
| 77 // extensions::ExtensionRegistryObserver implementation. | |
| 78 void OnExtensionLoaded(content::BrowserContext* browser_context, | |
| 79 const extensions::Extension* extension) override; | |
| 80 void OnExtensionUnloaded(content::BrowserContext* browser_context, | |
| 81 const extensions::Extension* extension, | |
| 82 extensions::UnloadedExtensionReason reason) override; | |
| 83 | |
| 84 ScopedObserver<extensions::ExtensionRegistry, | |
| 85 extensions::ExtensionRegistryObserver> | |
| 86 extension_registry_observer_; | |
| 87 | |
| 88 DISALLOW_COPY_AND_ASSIGN(UberFrameUI); | |
| 89 }; | 64 }; |
| 90 | 65 |
| 91 #endif // CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ | 66 #endif // CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ |
| OLD | NEW |