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

Side by Side Diff: chrome/browser/extensions/menu_manager.cc

Issue 204703002: Rename NOTIFICATION_EXTENSION_UNLOADED to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe upload wont do something bizarre this time Created 6 years, 9 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/extensions/menu_manager.h" 5 #include "chrome/browser/extensions/menu_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 return false; 295 return false;
296 } 296 }
297 } 297 }
298 return true; 298 return true;
299 } 299 }
300 300
301 MenuManager::MenuManager(Profile* profile, StateStore* store) 301 MenuManager::MenuManager(Profile* profile, StateStore* store)
302 : profile_(profile), store_(store) { 302 : profile_(profile), store_(store) {
303 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 303 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
304 content::Source<Profile>(profile)); 304 content::Source<Profile>(profile));
305 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 305 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
306 content::Source<Profile>(profile)); 306 content::Source<Profile>(profile));
307 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, 307 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
308 content::NotificationService::AllSources()); 308 content::NotificationService::AllSources());
309 if (store_) 309 if (store_)
310 store_->RegisterKey(kContextMenusKey); 310 store_->RegisterKey(kContextMenusKey);
311 } 311 }
312 312
313 MenuManager::~MenuManager() { 313 MenuManager::~MenuManager() {
314 MenuItemMap::iterator i; 314 MenuItemMap::iterator i;
315 for (i = context_items_.begin(); i != context_items_.end(); ++i) { 315 for (i = context_items_.begin(); i != context_items_.end(); ++i) {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } else { 820 } else {
821 AddContextItem(extension, items[i]); 821 AddContextItem(extension, items[i]);
822 } 822 }
823 } 823 }
824 } 824 }
825 825
826 void MenuManager::Observe(int type, 826 void MenuManager::Observe(int type,
827 const content::NotificationSource& source, 827 const content::NotificationSource& source,
828 const content::NotificationDetails& details) { 828 const content::NotificationDetails& details) {
829 switch (type) { 829 switch (type) {
830 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 830 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
831 // Remove menu items for disabled/uninstalled extensions. 831 // Remove menu items for disabled/uninstalled extensions.
832 const Extension* extension = 832 const Extension* extension =
833 content::Details<UnloadedExtensionInfo>(details)->extension; 833 content::Details<UnloadedExtensionInfo>(details)->extension;
834 MenuItem::ExtensionKey extension_key(extension->id()); 834 MenuItem::ExtensionKey extension_key(extension->id());
835 if (ContainsKey(context_items_, extension_key)) { 835 if (ContainsKey(context_items_, extension_key)) {
836 RemoveAllContextItems(extension_key); 836 RemoveAllContextItems(extension_key);
837 } 837 }
838 break; 838 break;
839 } 839 }
840 case chrome::NOTIFICATION_EXTENSION_LOADED: { 840 case chrome::NOTIFICATION_EXTENSION_LOADED: {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 if (uid < other.uid) 944 if (uid < other.uid)
945 return true; 945 return true;
946 if (uid == other.uid) 946 if (uid == other.uid)
947 return string_uid < other.string_uid; 947 return string_uid < other.string_uid;
948 } 948 }
949 } 949 }
950 return false; 950 return false;
951 } 951 }
952 952
953 } // namespace extensions 953 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/lazy_background_page_apitest.cc ('k') | chrome/browser/extensions/menu_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698