| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "content/public/browser/web_ui_controller.h" | 13 #include "content/public/browser/web_ui_controller.h" |
| 14 | 14 |
| 15 // The WebUI class for the uber page (chrome://chrome). It manages the UI for | 15 // The WebUI class for the uber page (chrome://chrome). It manages the UI for |
| 16 // the uber page (navigation bar and so forth) as well as WebUI objects for | 16 // the uber page (navigation bar and so forth) as well as WebUI objects for |
| 17 // pages that appear in the uber page. | 17 // pages that appear in the uber page. |
| 18 class UberUI : public content::WebUIController { | 18 class UberUI : public content::WebUIController { |
| 19 public: | 19 public: |
| 20 explicit UberUI(content::WebUI* web_ui); | 20 explicit UberUI(content::WebUI* web_ui); |
| 21 virtual ~UberUI(); | 21 virtual ~UberUI(); |
| 22 | 22 |
| 23 // WebUIController implementation. | 23 // WebUIController implementation. |
| 24 virtual bool OverrideHandleWebUIMessage(const GURL& source_url, | 24 virtual bool OverrideHandleWebUIMessage(const GURL& source_url, |
| 25 const std::string& message, | 25 const std::string& message, |
| 26 const ListValue& args) OVERRIDE; | 26 const ListValue& args) OVERRIDE; |
| 27 | 27 |
| 28 // We forward these to |sub_uis_|. | 28 // We forward these to |sub_uis_|. |
| 29 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 29 virtual void RenderViewCreated( |
| 30 virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE; | 30 content::RenderViewHost* render_view_host) OVERRIDE; |
| 31 virtual void RenderViewReused( |
| 32 content::RenderViewHost* render_view_host) OVERRIDE; |
| 31 virtual void DidBecomeActiveForReusedRenderView() OVERRIDE; | 33 virtual void DidBecomeActiveForReusedRenderView() OVERRIDE; |
| 32 | 34 |
| 33 private: | 35 private: |
| 34 // A map from URL origin to WebUI instance. | 36 // A map from URL origin to WebUI instance. |
| 35 typedef std::map<std::string, content::WebUI*> SubpageMap; | 37 typedef std::map<std::string, content::WebUI*> SubpageMap; |
| 36 | 38 |
| 37 // Creates and stores a WebUI for the given URL. | 39 // Creates and stores a WebUI for the given URL. |
| 38 void RegisterSubpage(const std::string& page_url); | 40 void RegisterSubpage(const std::string& page_url); |
| 39 | 41 |
| 40 // The WebUI*s in this map are owned. | 42 // The WebUI*s in this map are owned. |
| 41 SubpageMap sub_uis_; | 43 SubpageMap sub_uis_; |
| 42 | 44 |
| 43 DISALLOW_COPY_AND_ASSIGN(UberUI); | 45 DISALLOW_COPY_AND_ASSIGN(UberUI); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 class UberFrameUI : public content::WebUIController { | 48 class UberFrameUI : public content::WebUIController { |
| 47 public: | 49 public: |
| 48 explicit UberFrameUI(content::WebUI* web_ui); | 50 explicit UberFrameUI(content::WebUI* web_ui); |
| 49 virtual ~UberFrameUI(); | 51 virtual ~UberFrameUI(); |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(UberFrameUI); | 54 DISALLOW_COPY_AND_ASSIGN(UberFrameUI); |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 #endif // CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ | 57 #endif // CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_ |
| OLD | NEW |