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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 12 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
13 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" | 13 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" |
14 #include "chrome/browser/ui/webui/options/options_ui.h" | 14 #include "chrome/browser/ui/webui/options/options_ui.h" |
15 #include "chrome/common/extensions/extension_set.h" | |
16 #include "chrome/common/extensions/manifest_url_handler.h" | 15 #include "chrome/common/extensions/manifest_url_handler.h" |
17 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
18 #include "content/public/browser/navigation_controller.h" | 17 #include "content/public/browser/navigation_controller.h" |
19 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
20 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
21 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
22 #include "content/public/browser/web_ui.h" | 21 #include "content/public/browser/web_ui.h" |
23 #include "content/public/browser/web_ui_data_source.h" | 22 #include "content/public/browser/web_ui_data_source.h" |
| 23 #include "extensions/common/extension_set.h" |
24 #include "grit/browser_resources.h" | 24 #include "grit/browser_resources.h" |
25 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
27 | 27 |
28 using content::NavigationController; | 28 using content::NavigationController; |
29 using content::NavigationEntry; | 29 using content::NavigationEntry; |
30 using content::RenderViewHost; | 30 using content::RenderViewHost; |
31 using content::WebContents; | 31 using content::WebContents; |
32 | 32 |
33 namespace { | 33 namespace { |
(...skipping 27 matching lines...) Expand all Loading... |
61 source->AddString("settingsFrameURL", | 61 source->AddString("settingsFrameURL", |
62 ASCIIToUTF16(chrome::kChromeUISettingsFrameURL)); | 62 ASCIIToUTF16(chrome::kChromeUISettingsFrameURL)); |
63 source->AddString("settingsHost", | 63 source->AddString("settingsHost", |
64 ASCIIToUTF16(chrome::kChromeUISettingsHost)); | 64 ASCIIToUTF16(chrome::kChromeUISettingsHost)); |
65 | 65 |
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 extensions::ExtensionSet* extensionSet = |
72 profile->GetExtensionService()->extensions(); | 72 profile->GetExtensionService()->extensions(); |
73 | 73 |
74 for (ExtensionSet::const_iterator iter = extensionSet->begin(); | 74 for (extensions::ExtensionSet::const_iterator iter = extensionSet->begin(); |
75 iter != extensionSet->end(); ++iter) { | 75 iter != extensionSet->end(); ++iter) { |
76 extensions::URLOverrides::URLOverrideMap map = | 76 extensions::URLOverrides::URLOverrideMap map = |
77 extensions::URLOverrides::GetChromeURLOverrides(iter->get()); | 77 extensions::URLOverrides::GetChromeURLOverrides(iter->get()); |
78 extensions::URLOverrides::URLOverrideMap::const_iterator result = | 78 extensions::URLOverrides::URLOverrideMap::const_iterator result = |
79 map.find(std::string(extensionType)); | 79 map.find(std::string(extensionType)); |
80 | 80 |
81 if (result != map.end()) | 81 if (result != map.end()) |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 web_ui()->CallJavascriptFunction( | 215 web_ui()->CallJavascriptFunction( |
216 "uber_frame.setNavigationOverride", | 216 "uber_frame.setNavigationOverride", |
217 base::StringValue(chrome::kChromeUIHistoryHost), | 217 base::StringValue(chrome::kChromeUIHistoryHost), |
218 base::StringValue(overrides_history ? "yes" : "no")); | 218 base::StringValue(overrides_history ? "yes" : "no")); |
219 break; | 219 break; |
220 } | 220 } |
221 default: | 221 default: |
222 NOTREACHED(); | 222 NOTREACHED(); |
223 } | 223 } |
224 } | 224 } |
OLD | NEW |