Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(857)

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: 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
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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 AddURLProperty(properties, "frameUrl", params.frame_url); 610 AddURLProperty(properties, "frameUrl", params.frame_url);
611 611
612 if (params.selection_text.length() > 0) 612 if (params.selection_text.length() > 0)
613 properties->SetString("selectionText", params.selection_text); 613 properties->SetString("selectionText", params.selection_text);
614 614
615 properties->SetBoolean("editable", params.is_editable); 615 properties->SetBoolean("editable", params.is_editable);
616 616
617 args->Append(properties); 617 args->Append(properties);
618 618
619 // Add the tab info to the argument list. 619 // Add the tab info to the argument list.
620 // No tab info in a platform app
Mihai Parparita -not on Chrome 2012/08/16 19:52:42 Nit: Add period at the end of sentences.
620 // Note: web_contents only NULL in unit tests :( 621 // Note: web_contents only NULL in unit tests :(
Mihai Parparita -not on Chrome 2012/08/16 19:52:42 Nit: move this comment down one line to be just ab
621 if (web_contents) 622 if (!extension || !extension->is_platform_app()) {
622 args->Append(ExtensionTabUtil::CreateTabValue(web_contents)); 623 if (web_contents)
623 else 624 args->Append(ExtensionTabUtil::CreateTabValue(web_contents));
624 args->Append(new DictionaryValue()); 625 else
626 args->Append(new DictionaryValue());
627 }
625 628
626 if (item->type() == MenuItem::CHECKBOX || 629 if (item->type() == MenuItem::CHECKBOX ||
627 item->type() == MenuItem::RADIO) { 630 item->type() == MenuItem::RADIO) {
628 bool was_checked = item->checked(); 631 bool was_checked = item->checked();
629 properties->SetBoolean("wasChecked", was_checked); 632 properties->SetBoolean("wasChecked", was_checked);
630 633
631 // RADIO items always get set to true when you click on them, but CHECKBOX 634 // RADIO items always get set to true when you click on them, but CHECKBOX
632 // items get their state toggled. 635 // items get their state toggled.
633 bool checked = 636 bool checked =
634 (item->type() == MenuItem::RADIO) ? true : !was_checked; 637 (item->type() == MenuItem::RADIO) ? true : !was_checked;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 if (uid < other.uid) 818 if (uid < other.uid)
816 return true; 819 return true;
817 if (uid == other.uid) 820 if (uid == other.uid)
818 return string_uid < other.string_uid; 821 return string_uid < other.string_uid;
819 } 822 }
820 } 823 }
821 return false; 824 return false;
822 } 825 }
823 826
824 } // namespace extensions 827 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698