OLD | NEW |
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" |
11 | 11 |
12 namespace extension_browser_actions_api_constants { | |
13 | |
14 const char kSetNameFunction[] = "browserAction.setName"; | |
15 const char kSetIconFunction[] = "browserAction.setIcon"; | |
16 const char kSetBadgeTextFunction[] = "browserAction.setBadgeText"; | |
17 const char kSetBadgeBackgroundColorFunction[] = | |
18 "browserAction.setBadgeBackgroundColor"; | |
19 | |
20 } // namespace extension_browser_actions_api_constants | |
21 | |
22 namespace { | 12 namespace { |
23 // Errors. | 13 // Errors. |
24 const char kNoBrowserActionError[] = | 14 const char kNoBrowserActionError[] = |
25 "This extension has no browser action specified."; | 15 "This extension has no browser action specified."; |
26 const char kIconIndexOutOfBounds[] = | 16 const char kIconIndexOutOfBounds[] = |
27 "Browser action icon index out of bounds."; | 17 "Browser action icon index out of bounds."; |
28 } | 18 } |
29 | 19 |
30 bool BrowserActionSetNameFunction::RunImpl() { | 20 bool BrowserActionSetNameFunction::RunImpl() { |
31 std::string title; | 21 std::string title; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 116 } |
127 | 117 |
128 extension->browser_action_state()->set_badge_background_color(color); | 118 extension->browser_action_state()->set_badge_background_color(color); |
129 | 119 |
130 NotificationService::current()->Notify( | 120 NotificationService::current()->Notify( |
131 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, | 121 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, |
132 Source<ExtensionAction>(extension->browser_action()), | 122 Source<ExtensionAction>(extension->browser_action()), |
133 Details<ExtensionActionState>(extension->browser_action_state())); | 123 Details<ExtensionActionState>(extension->browser_action_state())); |
134 return true; | 124 return true; |
135 } | 125 } |
OLD | NEW |