| 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 "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 using content::NavigationEntry; | 30 using content::NavigationEntry; |
| 31 using content::RenderViewHost; | 31 using content::RenderViewHost; |
| 32 using content::WebContents; | 32 using content::WebContents; |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 content::WebUIDataSource* CreateUberHTMLSource() { | 36 content::WebUIDataSource* CreateUberHTMLSource() { |
| 37 content::WebUIDataSource* source = | 37 content::WebUIDataSource* source = |
| 38 content::WebUIDataSource::Create(chrome::kChromeUIUberHost); | 38 content::WebUIDataSource::Create(chrome::kChromeUIUberHost); |
| 39 | 39 |
| 40 source->SetUseJsonJSFormatV2(); | |
| 41 source->SetJsonPath("strings.js"); | 40 source->SetJsonPath("strings.js"); |
| 42 source->AddResourcePath("uber.js", IDR_UBER_JS); | 41 source->AddResourcePath("uber.js", IDR_UBER_JS); |
| 43 source->AddResourcePath("uber_utils.js", IDR_UBER_UTILS_JS); | 42 source->AddResourcePath("uber_utils.js", IDR_UBER_UTILS_JS); |
| 44 source->SetDefaultResource(IDR_UBER_HTML); | 43 source->SetDefaultResource(IDR_UBER_HTML); |
| 45 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); | 44 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); |
| 46 | 45 |
| 47 // Hack alert: continue showing "Loading..." until a real title is set. | 46 // Hack alert: continue showing "Loading..." until a real title is set. |
| 48 source->AddLocalizedString("pageTitle", IDS_TAB_LOADING_TITLE); | 47 source->AddLocalizedString("pageTitle", IDS_TAB_LOADING_TITLE); |
| 49 | 48 |
| 50 source->AddString("extensionsFrameURL", chrome::kChromeUIExtensionsFrameURL); | 49 source->AddString("extensionsFrameURL", chrome::kChromeUIExtensionsFrameURL); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 return true; | 70 return true; |
| 72 } | 71 } |
| 73 | 72 |
| 74 return false; | 73 return false; |
| 75 } | 74 } |
| 76 | 75 |
| 77 content::WebUIDataSource* CreateUberFrameHTMLSource(Profile* profile) { | 76 content::WebUIDataSource* CreateUberFrameHTMLSource(Profile* profile) { |
| 78 content::WebUIDataSource* source = | 77 content::WebUIDataSource* source = |
| 79 content::WebUIDataSource::Create(chrome::kChromeUIUberFrameHost); | 78 content::WebUIDataSource::Create(chrome::kChromeUIUberFrameHost); |
| 80 | 79 |
| 81 source->SetUseJsonJSFormatV2(); | |
| 82 source->SetJsonPath("strings.js"); | 80 source->SetJsonPath("strings.js"); |
| 83 source->AddResourcePath("uber_frame.js", IDR_UBER_FRAME_JS); | 81 source->AddResourcePath("uber_frame.js", IDR_UBER_FRAME_JS); |
| 84 source->SetDefaultResource(IDR_UBER_FRAME_HTML); | 82 source->SetDefaultResource(IDR_UBER_FRAME_HTML); |
| 85 | 83 |
| 86 // TODO(jhawkins): Attempt to get rid of IDS_SHORT_PRODUCT_OS_NAME. | 84 // TODO(jhawkins): Attempt to get rid of IDS_SHORT_PRODUCT_OS_NAME. |
| 87 #if defined(OS_CHROMEOS) | 85 #if defined(OS_CHROMEOS) |
| 88 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_OS_NAME); | 86 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_OS_NAME); |
| 89 #else | 87 #else |
| 90 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME); | 88 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME); |
| 91 #endif // defined(OS_CHROMEOS) | 89 #endif // defined(OS_CHROMEOS) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 web_ui()->CallJavascriptFunction( | 220 web_ui()->CallJavascriptFunction( |
| 223 "uber_frame.setNavigationOverride", | 221 "uber_frame.setNavigationOverride", |
| 224 base::StringValue(chrome::kChromeUIHistoryHost), | 222 base::StringValue(chrome::kChromeUIHistoryHost), |
| 225 base::StringValue(overrides_history ? "yes" : "no")); | 223 base::StringValue(overrides_history ? "yes" : "no")); |
| 226 break; | 224 break; |
| 227 } | 225 } |
| 228 default: | 226 default: |
| 229 NOTREACHED(); | 227 NOTREACHED(); |
| 230 } | 228 } |
| 231 } | 229 } |
| OLD | NEW |