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

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

Issue 10832348: Tab value for context menu onclick event should be optional. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update the test code to chrome.app.runtime instead of experimental Created 8 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
« no previous file with comments | « no previous file | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 AddURLProperty(properties, "frameUrl", params.frame_url); 633 AddURLProperty(properties, "frameUrl", params.frame_url);
634 634
635 if (params.selection_text.length() > 0) 635 if (params.selection_text.length() > 0)
636 properties->SetString("selectionText", params.selection_text); 636 properties->SetString("selectionText", params.selection_text);
637 637
638 properties->SetBoolean("editable", params.is_editable); 638 properties->SetBoolean("editable", params.is_editable);
639 639
640 args->Append(properties); 640 args->Append(properties);
641 641
642 // Add the tab info to the argument list. 642 // Add the tab info to the argument list.
643 // Note: web_contents only NULL in unit tests :( 643 // No tab info in a platform app.
644 if (web_contents) 644 if (!extension || !extension->is_platform_app()) {
645 args->Append(ExtensionTabUtil::CreateTabValue(web_contents)); 645 // Note: web_contents only NULL in unit tests :(
646 else 646 if (web_contents)
647 args->Append(new DictionaryValue()); 647 args->Append(ExtensionTabUtil::CreateTabValue(web_contents));
648 else
649 args->Append(new DictionaryValue());
650 }
648 651
649 if (item->type() == MenuItem::CHECKBOX || 652 if (item->type() == MenuItem::CHECKBOX ||
650 item->type() == MenuItem::RADIO) { 653 item->type() == MenuItem::RADIO) {
651 bool was_checked = item->checked(); 654 bool was_checked = item->checked();
652 properties->SetBoolean("wasChecked", was_checked); 655 properties->SetBoolean("wasChecked", was_checked);
653 656
654 // RADIO items always get set to true when you click on them, but CHECKBOX 657 // RADIO items always get set to true when you click on them, but CHECKBOX
655 // items get their state toggled. 658 // items get their state toggled.
656 bool checked = 659 bool checked =
657 (item->type() == MenuItem::RADIO) ? true : !was_checked; 660 (item->type() == MenuItem::RADIO) ? true : !was_checked;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 if (uid < other.uid) 841 if (uid < other.uid)
839 return true; 842 return true;
840 if (uid == other.uid) 843 if (uid == other.uid)
841 return string_uid < other.string_uid; 844 return string_uid < other.string_uid;
842 } 845 }
843 } 846 }
844 return false; 847 return false;
845 } 848 }
846 849
847 } // namespace extensions 850 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698