| 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 #include "chrome/browser/ui/webui/uber/uber_ui.h" | 5 #include "chrome/browser/ui/webui/uber/uber_ui.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 11 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 12 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" | 12 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" |
| 13 #include "chrome/browser/ui/webui/log_web_ui_url.h" | 13 #include "chrome/browser/ui/webui/log_web_ui_url.h" |
| 14 #include "chrome/browser/ui/webui/options/options_ui.h" | |
| 15 #include "chrome/common/chrome_features.h" | 14 #include "chrome/common/chrome_features.h" |
| 16 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" | 16 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" |
| 18 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 19 #include "chrome/grit/browser_resources.h" | 18 #include "chrome/grit/browser_resources.h" |
| 20 #include "chrome/grit/chromium_strings.h" | 19 #include "chrome/grit/chromium_strings.h" |
| 21 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 22 #include "components/strings/grit/components_strings.h" | 21 #include "components/strings/grit/components_strings.h" |
| 23 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
| 24 #include "content/public/browser/navigation_controller.h" | 23 #include "content/public/browser/navigation_controller.h" |
| 25 #include "content/public/browser/navigation_entry.h" | 24 #include "content/public/browser/navigation_entry.h" |
| 26 #include "content/public/browser/navigation_handle.h" | 25 #include "content/public/browser/navigation_handle.h" |
| 27 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
| 28 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/browser/web_ui.h" | 28 #include "content/public/browser/web_ui.h" |
| 30 #include "content/public/browser/web_ui_data_source.h" | 29 #include "content/public/browser/web_ui_data_source.h" |
| 31 #include "content/public/common/browser_side_navigation_policy.h" | 30 #include "content/public/common/browser_side_navigation_policy.h" |
| 32 | 31 |
| 32 #if defined(OS_CHROMEOS) |
| 33 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 34 #endif |
| 35 |
| 33 using content::NavigationController; | 36 using content::NavigationController; |
| 34 using content::NavigationEntry; | 37 using content::NavigationEntry; |
| 35 using content::RenderFrameHost; | 38 using content::RenderFrameHost; |
| 36 using content::WebContents; | 39 using content::WebContents; |
| 37 | 40 |
| 38 namespace { | 41 namespace { |
| 39 | 42 |
| 40 content::WebUIDataSource* CreateUberHTMLSource() { | 43 content::WebUIDataSource* CreateUberHTMLSource() { |
| 41 content::WebUIDataSource* source = | 44 content::WebUIDataSource* source = |
| 42 content::WebUIDataSource::Create(chrome::kChromeUIUberHost); | 45 content::WebUIDataSource::Create(chrome::kChromeUIUberHost); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 123 |
| 121 UberUI::UberUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 124 UberUI::UberUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 122 subframe_logger_ = base::MakeUnique<SubframeLogger>(web_ui->GetWebContents()); | 125 subframe_logger_ = base::MakeUnique<SubframeLogger>(web_ui->GetWebContents()); |
| 123 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 126 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
| 124 CreateUberHTMLSource()); | 127 CreateUberHTMLSource()); |
| 125 | 128 |
| 126 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL, | 129 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL, |
| 127 chrome::kChromeUIExtensionsHost); | 130 chrome::kChromeUIExtensionsHost); |
| 128 RegisterSubpage(chrome::kChromeUIHelpFrameURL, | 131 RegisterSubpage(chrome::kChromeUIHelpFrameURL, |
| 129 chrome::kChromeUIHelpHost); | 132 chrome::kChromeUIHelpHost); |
| 133 #if defined(OS_CHROMEOS) |
| 130 RegisterSubpage(chrome::kChromeUISettingsFrameURL, | 134 RegisterSubpage(chrome::kChromeUISettingsFrameURL, |
| 131 chrome::kChromeUISettingsHost); | 135 chrome::kChromeUISettingsHost); |
| 136 #endif |
| 132 RegisterSubpage(chrome::kChromeUIUberFrameURL, | 137 RegisterSubpage(chrome::kChromeUIUberFrameURL, |
| 133 chrome::kChromeUIUberHost); | 138 chrome::kChromeUIUberHost); |
| 134 } | 139 } |
| 135 | 140 |
| 136 UberUI::~UberUI() { | 141 UberUI::~UberUI() { |
| 137 } | 142 } |
| 138 | 143 |
| 139 void UberUI::RegisterSubpage(const std::string& page_url, | 144 void UberUI::RegisterSubpage(const std::string& page_url, |
| 140 const std::string& page_host) { | 145 const std::string& page_host) { |
| 141 sub_uis_[page_url] = web_ui()->GetWebContents()->CreateSubframeWebUI( | 146 sub_uis_[page_url] = web_ui()->GetWebContents()->CreateSubframeWebUI( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 182 |
| 178 UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 183 UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 179 content::BrowserContext* browser_context = | 184 content::BrowserContext* browser_context = |
| 180 web_ui->GetWebContents()->GetBrowserContext(); | 185 web_ui->GetWebContents()->GetBrowserContext(); |
| 181 content::WebUIDataSource::Add(browser_context, | 186 content::WebUIDataSource::Add(browser_context, |
| 182 CreateUberFrameHTMLSource(browser_context)); | 187 CreateUberFrameHTMLSource(browser_context)); |
| 183 } | 188 } |
| 184 | 189 |
| 185 UberFrameUI::~UberFrameUI() { | 190 UberFrameUI::~UberFrameUI() { |
| 186 } | 191 } |
| OLD | NEW |