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/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 "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // RADIO items always get set to true when you click on them, but CHECKBOX | 450 // RADIO items always get set to true when you click on them, but CHECKBOX |
451 // items get their state toggled. | 451 // items get their state toggled. |
452 bool checked = | 452 bool checked = |
453 (item->type() == ExtensionMenuItem::RADIO) ? true : !was_checked; | 453 (item->type() == ExtensionMenuItem::RADIO) ? true : !was_checked; |
454 | 454 |
455 item->SetChecked(checked); | 455 item->SetChecked(checked); |
456 properties->SetBoolean("checked", item->checked()); | 456 properties->SetBoolean("checked", item->checked()); |
457 } | 457 } |
458 | 458 |
459 std::string json_args; | 459 std::string json_args; |
460 base::JSONWriter::Write(&args, false, &json_args); | 460 base::JSONWriter::Write(&args, &json_args); |
461 std::string event_name = "contextMenus"; | 461 std::string event_name = "contextMenus"; |
462 event_router->DispatchEventToExtension( | 462 event_router->DispatchEventToExtension( |
463 item->extension_id(), event_name, json_args, profile, GURL(), | 463 item->extension_id(), event_name, json_args, profile, GURL(), |
464 ExtensionEventRouter::USER_GESTURE_ENABLED); | 464 ExtensionEventRouter::USER_GESTURE_ENABLED); |
465 } | 465 } |
466 | 466 |
467 void ExtensionMenuManager::SanitizeRadioList( | 467 void ExtensionMenuManager::SanitizeRadioList( |
468 const ExtensionMenuItem::List& item_list) { | 468 const ExtensionMenuItem::List& item_list) { |
469 ExtensionMenuItem::List::const_iterator i = item_list.begin(); | 469 ExtensionMenuItem::List::const_iterator i = item_list.begin(); |
470 while (i != item_list.end()) { | 470 while (i != item_list.end()) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 if (profile < other.profile) | 567 if (profile < other.profile) |
568 return true; | 568 return true; |
569 if (profile == other.profile) { | 569 if (profile == other.profile) { |
570 if (extension_id < other.extension_id) | 570 if (extension_id < other.extension_id) |
571 return true; | 571 return true; |
572 if (extension_id == other.extension_id) | 572 if (extension_id == other.extension_id) |
573 return uid < other.uid; | 573 return uid < other.uid; |
574 } | 574 } |
575 return false; | 575 return false; |
576 } | 576 } |
OLD | NEW |