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

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 10834106: Implement Keybinding for script badges. (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/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 errors::kInvalidKeyBindingDictionary, 1468 errors::kInvalidKeyBindingDictionary,
1469 base::IntToString(command_index)); 1469 base::IntToString(command_index));
1470 return false; 1470 return false;
1471 } 1471 }
1472 1472
1473 scoped_ptr<extensions::Command> binding(new extensions::Command()); 1473 scoped_ptr<extensions::Command> binding(new extensions::Command());
1474 if (!binding->Parse(command, *iter, command_index, error)) 1474 if (!binding->Parse(command, *iter, command_index, error))
1475 return false; // |error| already set. 1475 return false; // |error| already set.
1476 1476
1477 std::string command_name = binding->command_name(); 1477 std::string command_name = binding->command_name();
1478 if (command_name == values::kPageActionKeybindingEvent) { 1478 if (command_name == values::kPageActionCommandEvent) {
1479 page_action_command_.reset(binding.release()); 1479 page_action_command_.reset(binding.release());
1480 } else if (command_name == values::kBrowserActionKeybindingEvent) { 1480 } else if (command_name == values::kBrowserActionCommandEvent) {
1481 browser_action_command_.reset(binding.release()); 1481 browser_action_command_.reset(binding.release());
1482 } else if (command_name == values::kScriptBadgeCommandEvent) {
1483 script_badge_command_.reset(binding.release());
1482 } else { 1484 } else {
1483 if (command_name[0] != '_') // All commands w/underscore are reserved. 1485 if (command_name[0] != '_') // All commands w/underscore are reserved.
1484 named_commands_[command_name] = *binding.get(); 1486 named_commands_[command_name] = *binding.get();
1485 } 1487 }
1486 } 1488 }
1487 } 1489 }
1488 1490
1489 if (manifest_->HasKey(keys::kBrowserAction) && 1491 if (manifest_->HasKey(keys::kBrowserAction) &&
1490 !browser_action_command_.get()) { 1492 !browser_action_command_.get()) {
1491 // If the extension defines a browser action, but no command for it, then 1493 // If the extension defines a browser action, but no command for it, then
1492 // we synthesize a generic one, so the user can configure a shortcut for it. 1494 // we synthesize a generic one, so the user can configure a shortcut for it.
1493 // No keyboard shortcut will be assigned to it, until the user selects one. 1495 // No keyboard shortcut will be assigned to it, until the user selects one.
1494 browser_action_command_.reset( 1496 browser_action_command_.reset(
1495 new extensions::Command( 1497 new extensions::Command(
1496 values::kBrowserActionKeybindingEvent, string16(), "")); 1498 values::kBrowserActionCommandEvent, string16(), ""));
1497 } 1499 }
1498 1500
1499 return true; 1501 return true;
1500 } 1502 }
1501 1503
1502 bool Extension::LoadPlugins(string16* error) { 1504 bool Extension::LoadPlugins(string16* error) {
1503 if (!manifest_->HasKey(keys::kPlugins)) 1505 if (!manifest_->HasKey(keys::kPlugins))
1504 return true; 1506 return true;
1505 ListValue* list_value = NULL; 1507 ListValue* list_value = NULL;
1506 if (!manifest_->GetList(keys::kPlugins, &list_value)) { 1508 if (!manifest_->GetList(keys::kPlugins, &list_value)) {
(...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after
3884 3886
3885 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3887 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3886 const Extension* extension, 3888 const Extension* extension,
3887 const PermissionSet* permissions, 3889 const PermissionSet* permissions,
3888 Reason reason) 3890 Reason reason)
3889 : reason(reason), 3891 : reason(reason),
3890 extension(extension), 3892 extension(extension),
3891 permissions(permissions) {} 3893 permissions(permissions) {}
3892 3894
3893 } // namespace extensions 3895 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698