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" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 switch (type) { | 203 switch (type) { |
204 // We listen for notifications that indicate an extension has been loaded | 204 // We listen for notifications that indicate an extension has been loaded |
205 // (i.e., has been installed and/or enabled) or unloaded (i.e., has been | 205 // (i.e., has been installed and/or enabled) or unloaded (i.e., has been |
206 // uninstalled and/or disabled). If one of these events has occurred, then | 206 // uninstalled and/or disabled). If one of these events has occurred, then |
207 // we must update the behavior of the History navigation element so that | 207 // we must update the behavior of the History navigation element so that |
208 // it opens the history extension if one is installed and enabled or | 208 // it opens the history extension if one is installed and enabled or |
209 // opens the default history page if one is uninstalled or disabled. | 209 // opens the default history page if one is uninstalled or disabled. |
210 case chrome::NOTIFICATION_EXTENSION_LOADED: | 210 case chrome::NOTIFICATION_EXTENSION_LOADED: |
211 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 211 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
212 Profile* profile = Profile::FromWebUI(web_ui()); | 212 Profile* profile = Profile::FromWebUI(web_ui()); |
213 bool overridesHistory = HasExtensionType(profile, | 213 bool overrides_history = |
214 chrome::kChromeUIHistoryHost); | 214 HasExtensionType(profile, chrome::kChromeUIHistoryHost); |
215 scoped_ptr<Value> controlsValue( | |
216 Value::CreateStringValue(chrome::kChromeUIHistoryHost)); | |
217 scoped_ptr<Value> overrideValue( | |
218 Value::CreateStringValue(overridesHistory ? "yes" : "no")); | |
219 web_ui()->CallJavascriptFunction( | 215 web_ui()->CallJavascriptFunction( |
220 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue); | 216 "uber_frame.setNavigationOverride", |
| 217 base::StringValue(chrome::kChromeUIHistoryHost), |
| 218 base::StringValue(overrides_history ? "yes" : "no")); |
221 break; | 219 break; |
222 } | 220 } |
223 default: | 221 default: |
224 NOTREACHED(); | 222 NOTREACHED(); |
225 } | 223 } |
226 } | 224 } |
OLD | NEW |