| 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/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME); | 33 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME); |
| 34 | 34 |
| 35 source->AddString("settingsHost", | 35 source->AddString("settingsHost", |
| 36 ASCIIToUTF16(chrome::kChromeUISettingsHost)); | 36 ASCIIToUTF16(chrome::kChromeUISettingsHost)); |
| 37 source->AddLocalizedString("settingsDisplayName", IDS_SETTINGS_TITLE); | 37 source->AddLocalizedString("settingsDisplayName", IDS_SETTINGS_TITLE); |
| 38 source->AddString("extensionsHost", | 38 source->AddString("extensionsHost", |
| 39 ASCIIToUTF16(chrome::kChromeUIExtensionsHost)); | 39 ASCIIToUTF16(chrome::kChromeUIExtensionsHost)); |
| 40 source->AddLocalizedString("extensionsDisplayName", | 40 source->AddLocalizedString("extensionsDisplayName", |
| 41 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); | 41 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); |
| 42 | 42 |
| 43 #if defined(OS_CHROMEOS) | |
| 44 source->AddString("aboutPageHost", | |
| 45 ASCIIToUTF16(chrome::kAboutOptionsSubPage)); | |
| 46 source->AddLocalizedString("aboutPageDisplayName", IDS_ABOUT_TAB_TITLE); | |
| 47 #endif | |
| 48 return source; | 43 return source; |
| 49 } | 44 } |
| 50 | 45 |
| 51 } // namespace | 46 } // namespace |
| 52 | 47 |
| 53 UberUI::UberUI(WebContents* contents) : WebUI(contents) { | 48 UberUI::UberUI(WebContents* contents) : WebUI(contents) { |
| 54 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 49 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 55 profile->GetChromeURLDataManager()->AddDataSource(CreateUberHTMLSource()); | 50 profile->GetChromeURLDataManager()->AddDataSource(CreateUberHTMLSource()); |
| 56 | 51 |
| 57 RegisterSubpage(chrome::kChromeUISettingsFrameURL); | 52 RegisterSubpage(chrome::kChromeUISettingsFrameURL); |
| 58 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL); | 53 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL); |
| 59 #if defined(OS_CHROMEOS) | |
| 60 RegisterSubpage(chrome::kChromeUIAboutPageFrameURL); | |
| 61 #endif | |
| 62 } | 54 } |
| 63 | 55 |
| 64 UberUI::~UberUI() { | 56 UberUI::~UberUI() { |
| 65 STLDeleteValues(&sub_uis_); | 57 STLDeleteValues(&sub_uis_); |
| 66 } | 58 } |
| 67 | 59 |
| 68 void UberUI::RegisterSubpage(const std::string& page_url) { | 60 void UberUI::RegisterSubpage(const std::string& page_url) { |
| 69 WebUI* web_ui = ChromeWebUIFactory::GetInstance()->CreateWebUIForURL( | 61 WebUI* web_ui = ChromeWebUIFactory::GetInstance()->CreateWebUIForURL( |
| 70 web_contents_, GURL(page_url)); | 62 web_contents_, GURL(page_url)); |
| 71 | 63 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 SubpageMap::iterator subpage = sub_uis_.find(source_url.GetOrigin().spec()); | 99 SubpageMap::iterator subpage = sub_uis_.find(source_url.GetOrigin().spec()); |
| 108 if (subpage == sub_uis_.end()) { | 100 if (subpage == sub_uis_.end()) { |
| 109 // The message was sent from the uber page itself. | 101 // The message was sent from the uber page itself. |
| 110 DCHECK_EQ(std::string(chrome::kChromeUIUberHost), source_url.host()); | 102 DCHECK_EQ(std::string(chrome::kChromeUIUberHost), source_url.host()); |
| 111 WebUI::OnWebUISend(source_url, message, args); | 103 WebUI::OnWebUISend(source_url, message, args); |
| 112 } else { | 104 } else { |
| 113 // The message was sent from a subpage. | 105 // The message was sent from a subpage. |
| 114 subpage->second->OnWebUISend(source_url, message, args); | 106 subpage->second->OnWebUISend(source_url, message, args); |
| 115 } | 107 } |
| 116 } | 108 } |
| OLD | NEW |