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

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

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

Powered by Google App Engine
This is Rietveld 408576698