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

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

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 3 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extension_menu_manager.h" 5 #include "chrome/browser/extensions/extension_menu_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 bool checked = 434 bool checked =
435 (item->type() == ExtensionMenuItem::RADIO) ? true : !was_checked; 435 (item->type() == ExtensionMenuItem::RADIO) ? true : !was_checked;
436 436
437 item->SetChecked(checked); 437 item->SetChecked(checked);
438 properties->SetBoolean("checked", item->checked()); 438 properties->SetBoolean("checked", item->checked());
439 } 439 }
440 440
441 std::string json_args; 441 std::string json_args;
442 base::JSONWriter::Write(&args, false, &json_args); 442 base::JSONWriter::Write(&args, false, &json_args);
443 std::string event_name = "contextMenus/" + item->extension_id(); 443 std::string event_name = "contextMenus/" + item->extension_id();
444 service->DispatchEventToRenderers(event_name, json_args, 444 service->DispatchEventToRenderers(event_name, json_args, profile, GURL());
445 profile->IsOffTheRecord(), GURL());
446 } 445 }
447 446
448 void ExtensionMenuManager::Observe(NotificationType type, 447 void ExtensionMenuManager::Observe(NotificationType type,
449 const NotificationSource& source, 448 const NotificationSource& source,
450 const NotificationDetails& details) { 449 const NotificationDetails& details) {
451 // Remove menu items for disabled/uninstalled extensions. 450 // Remove menu items for disabled/uninstalled extensions.
452 if (type != NotificationType::EXTENSION_UNLOADED) { 451 if (type != NotificationType::EXTENSION_UNLOADED) {
453 NOTREACHED(); 452 NOTREACHED();
454 return; 453 return;
455 } 454 }
456 Extension* extension = Details<Extension>(details).ptr(); 455 Extension* extension = Details<Extension>(details).ptr();
457 if (ContainsKey(context_items_, extension->id())) { 456 if (ContainsKey(context_items_, extension->id())) {
458 RemoveAllContextItems(extension->id()); 457 RemoveAllContextItems(extension->id());
459 } 458 }
460 } 459 }
461 460
462 const SkBitmap& ExtensionMenuManager::GetIconForExtension( 461 const SkBitmap& ExtensionMenuManager::GetIconForExtension(
463 const std::string& extension_id) { 462 const std::string& extension_id) {
464 return icon_manager_.GetIcon(extension_id); 463 return icon_manager_.GetIcon(extension_id);
465 } 464 }
466 465
467 // static 466 // static
468 bool ExtensionMenuManager::HasAllowedScheme(const GURL& url) { 467 bool ExtensionMenuManager::HasAllowedScheme(const GURL& url) {
469 URLPattern pattern(kAllowedSchemes); 468 URLPattern pattern(kAllowedSchemes);
470 return pattern.SetScheme(url.scheme()); 469 return pattern.SetScheme(url.scheme());
471 } 470 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_incognito_apitest.cc ('k') | chrome/browser/extensions/extension_menu_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698