| 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, false, &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::kIsUserGesture); |
| 464 } | 465 } |
| 465 | 466 |
| 466 void ExtensionMenuManager::SanitizeRadioList( | 467 void ExtensionMenuManager::SanitizeRadioList( |
| 467 const ExtensionMenuItem::List& item_list) { | 468 const ExtensionMenuItem::List& item_list) { |
| 468 ExtensionMenuItem::List::const_iterator i = item_list.begin(); | 469 ExtensionMenuItem::List::const_iterator i = item_list.begin(); |
| 469 while (i != item_list.end()) { | 470 while (i != item_list.end()) { |
| 470 if ((*i)->type() != ExtensionMenuItem::RADIO) { | 471 if ((*i)->type() != ExtensionMenuItem::RADIO) { |
| 471 ++i; | 472 ++i; |
| 472 break; | 473 break; |
| 473 } | 474 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (profile < other.profile) | 567 if (profile < other.profile) |
| 567 return true; | 568 return true; |
| 568 if (profile == other.profile) { | 569 if (profile == other.profile) { |
| 569 if (extension_id < other.extension_id) | 570 if (extension_id < other.extension_id) |
| 570 return true; | 571 return true; |
| 571 if (extension_id == other.extension_id) | 572 if (extension_id == other.extension_id) |
| 572 return uid < other.uid; | 573 return uid < other.uid; |
| 573 } | 574 } |
| 574 return false; | 575 return false; |
| 575 } | 576 } |
| OLD | NEW |