Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/browser/ui/webui/uber/uber_ui.cc

Issue 11660016: Move the parsing of "chrome_url_overrides" out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments addressed Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/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"
11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
12 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 12 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
13 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 13 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
14 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" 14 #include "chrome/browser/ui/webui/extensions/extensions_ui.h"
15 #include "chrome/browser/ui/webui/options/options_ui.h" 15 #include "chrome/browser/ui/webui/options/options_ui.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/extension_set.h" 17 #include "chrome/common/extensions/extension_set.h"
18 #include "chrome/common/extensions/manifest_url_handler.h"
19 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "content/public/browser/navigation_controller.h" 20 #include "content/public/browser/navigation_controller.h"
21 #include "content/public/browser/navigation_entry.h" 21 #include "content/public/browser/navigation_entry.h"
22 #include "content/public/browser/notification_source.h" 22 #include "content/public/browser/notification_source.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_ui.h" 24 #include "content/public/browser/web_ui.h"
25 #include "grit/browser_resources.h" 25 #include "grit/browser_resources.h"
26 #include "grit/chromium_strings.h" 26 #include "grit/chromium_strings.h"
27 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
28 28
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return source; 66 return source;
67 } 67 }
68 68
69 // Determines whether the user has an active extension of the given type. 69 // Determines whether the user has an active extension of the given type.
70 bool HasExtensionType(Profile* profile, const char* extensionType) { 70 bool HasExtensionType(Profile* profile, const char* extensionType) {
71 const ExtensionSet* extensionSet = 71 const ExtensionSet* extensionSet =
72 profile->GetExtensionService()->extensions(); 72 profile->GetExtensionService()->extensions();
73 73
74 for (ExtensionSet::const_iterator iter = extensionSet->begin(); 74 for (ExtensionSet::const_iterator iter = extensionSet->begin();
75 iter != extensionSet->end(); ++iter) { 75 iter != extensionSet->end(); ++iter) {
76 extensions::Extension::URLOverrideMap map = 76 const extensions::URLOverrides::URLOverrideMap* map =
77 (*iter)->GetChromeURLOverrides(); 77 extensions::URLOverrides::GetChromeURLOverrides(*iter);
78 extensions::Extension::URLOverrideMap::const_iterator result = 78 if (!map)
79 map.find(std::string(extensionType)); 79 continue;
80 extensions::URLOverrides::URLOverrideMap::const_iterator result =
81 map->find(std::string(extensionType));
80 82
81 if (result != map.end()) 83 if (result != map->end())
82 return true; 84 return true;
83 } 85 }
84 86
85 return false; 87 return false;
86 } 88 }
87 89
88 ChromeWebUIDataSource* CreateUberFrameHTMLSource(Profile* profile) { 90 ChromeWebUIDataSource* CreateUberFrameHTMLSource(Profile* profile) {
89 ChromeWebUIDataSource* source = 91 ChromeWebUIDataSource* source =
90 new ChromeWebUIDataSource(chrome::kChromeUIUberFrameHost); 92 new ChromeWebUIDataSource(chrome::kChromeUIUberFrameHost);
91 93
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 scoped_ptr<Value> overrideValue( 218 scoped_ptr<Value> overrideValue(
217 Value::CreateStringValue(overridesHistory ? "yes" : "no")); 219 Value::CreateStringValue(overridesHistory ? "yes" : "no"));
218 web_ui()->CallJavascriptFunction( 220 web_ui()->CallJavascriptFunction(
219 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue); 221 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue);
220 break; 222 break;
221 } 223 }
222 default: 224 default:
223 NOTREACHED(); 225 NOTREACHED();
224 } 226 }
225 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698