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

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

Issue 275007: Update page action manifest parsing to match the new format. (Closed)
Patch Set: cleanup Created 11 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_browser_event_router.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_browser_actions_api.h" 5 #include "chrome/browser/extensions/extension_browser_actions_api.h"
6 6
7 #include "chrome/browser/browser.h" 7 #include "chrome/browser/browser.h"
8 #include "chrome/browser/browser_list.h" 8 #include "chrome/browser/browser_list.h"
9 #include "chrome/common/notification_service.h" 9 #include "chrome/common/notification_service.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 // Errors. 23 // Errors.
24 const char kNoBrowserActionError[] = 24 const char kNoBrowserActionError[] =
25 "This extension has no browser action specified."; 25 "This extension has no browser action specified.";
26 const char kIconIndexOutOfBounds[] = 26 const char kIconIndexOutOfBounds[] =
27 "Browser action icon index out of bounds."; 27 "Browser action icon index out of bounds.";
28 } 28 }
29 29
30 bool BrowserActionSetNameFunction::RunImpl() { 30 bool BrowserActionSetNameFunction::RunImpl() {
31 std::string name; 31 std::string title;
32 EXTENSION_FUNCTION_VALIDATE(args_->GetAsString(&name)); 32 EXTENSION_FUNCTION_VALIDATE(args_->GetAsString(&title));
33 33
34 Extension* extension = dispatcher()->GetExtension(); 34 Extension* extension = dispatcher()->GetExtension();
35 if (!extension->browser_action()) { 35 if (!extension->browser_action()) {
36 error_ = kNoBrowserActionError; 36 error_ = kNoBrowserActionError;
37 return false; 37 return false;
38 } 38 }
39 39
40 extension->browser_action_state()->set_title(name); 40 extension->browser_action_state()->set_title(title);
41 41
42 NotificationService::current()->Notify( 42 NotificationService::current()->Notify(
43 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, 43 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED,
44 Source<ExtensionAction>(extension->browser_action()), 44 Source<ExtensionAction>(extension->browser_action()),
45 Details<ExtensionActionState>(extension->browser_action_state())); 45 Details<ExtensionActionState>(extension->browser_action_state()));
46 return true; 46 return true;
47 } 47 }
48 48
49 bool BrowserActionSetIconFunction::RunImpl() { 49 bool BrowserActionSetIconFunction::RunImpl() {
50 // setIcon can take a variant argument: either a canvas ImageData, or an 50 // setIcon can take a variant argument: either a canvas ImageData, or an
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 126 }
127 127
128 extension->browser_action_state()->set_badge_background_color(color); 128 extension->browser_action_state()->set_badge_background_color(color);
129 129
130 NotificationService::current()->Notify( 130 NotificationService::current()->Notify(
131 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, 131 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED,
132 Source<ExtensionAction>(extension->browser_action()), 132 Source<ExtensionAction>(extension->browser_action()),
133 Details<ExtensionActionState>(extension->browser_action_state())); 133 Details<ExtensionActionState>(extension->browser_action_state()));
134 return true; 134 return true;
135 } 135 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_browser_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698