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

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

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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/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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return true; 195 return true;
196 } 196 }
197 197
198 // UberFrameUI 198 // UberFrameUI
199 199
200 UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) { 200 UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) {
201 Profile* profile = Profile::FromWebUI(web_ui); 201 Profile* profile = Profile::FromWebUI(web_ui);
202 content::WebUIDataSource::Add(profile, CreateUberFrameHTMLSource(profile)); 202 content::WebUIDataSource::Add(profile, CreateUberFrameHTMLSource(profile));
203 203
204 // Register as an observer for when extensions are loaded and unloaded. 204 // Register as an observer for when extensions are loaded and unloaded.
205 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 205 registrar_.Add(this,
206 content::Source<Profile>(profile)); 206 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
207 content::Source<Profile>(profile));
207 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 208 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
208 content::Source<Profile>(profile)); 209 content::Source<Profile>(profile));
209 } 210 }
210 211
211 UberFrameUI::~UberFrameUI() { 212 UberFrameUI::~UberFrameUI() {
212 } 213 }
213 214
214 void UberFrameUI::Observe(int type, const content::NotificationSource& source, 215 void UberFrameUI::Observe(int type, const content::NotificationSource& source,
215 const content::NotificationDetails& details) { 216 const content::NotificationDetails& details) {
216 switch (type) { 217 switch (type) {
217 // We listen for notifications that indicate an extension has been loaded 218 // We listen for notifications that indicate an extension has been loaded
218 // (i.e., has been installed and/or enabled) or unloaded (i.e., has been 219 // (i.e., has been installed and/or enabled) or unloaded (i.e., has been
219 // uninstalled and/or disabled). If one of these events has occurred, then 220 // uninstalled and/or disabled). If one of these events has occurred, then
220 // we must update the behavior of the History navigation element so that 221 // we must update the behavior of the History navigation element so that
221 // it opens the history extension if one is installed and enabled or 222 // it opens the history extension if one is installed and enabled or
222 // opens the default history page if one is uninstalled or disabled. 223 // opens the default history page if one is uninstalled or disabled.
223 case chrome::NOTIFICATION_EXTENSION_LOADED: 224 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED:
224 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { 225 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
225 Profile* profile = Profile::FromWebUI(web_ui()); 226 Profile* profile = Profile::FromWebUI(web_ui());
226 bool overrides_history = 227 bool overrides_history =
227 HasExtensionType(profile, chrome::kChromeUIHistoryHost); 228 HasExtensionType(profile, chrome::kChromeUIHistoryHost);
228 web_ui()->CallJavascriptFunction( 229 web_ui()->CallJavascriptFunction(
229 "uber_frame.setNavigationOverride", 230 "uber_frame.setNavigationOverride",
230 base::StringValue(chrome::kChromeUIHistoryHost), 231 base::StringValue(chrome::kChromeUIHistoryHost),
231 base::StringValue(overrides_history ? "yes" : "no")); 232 base::StringValue(overrides_history ? "yes" : "no"));
232 break; 233 break;
233 } 234 }
234 default: 235 default:
235 NOTREACHED(); 236 NOTREACHED();
236 } 237 }
237 } 238 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/policy_ui.cc ('k') | chrome/test/remoting/remote_desktop_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698