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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 if (!browser_action_) { | 29 if (!browser_action_) { |
30 error_ = kNoBrowserActionError; | 30 error_ = kNoBrowserActionError; |
31 return false; | 31 return false; |
32 } | 32 } |
33 | 33 |
34 if (!RunBrowserAction()) | 34 if (!RunBrowserAction()) |
35 return false; | 35 return false; |
36 | 36 |
37 NotificationService::current()->Notify( | 37 NotificationService::current()->Notify( |
38 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, | 38 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, |
39 Source<ExtensionAction2>(browser_action_), | 39 Source<ExtensionAction>(browser_action_), |
40 NotificationService::NoDetails()); | 40 NotificationService::NoDetails()); |
41 return true; | 41 return true; |
42 } | 42 } |
43 | 43 |
44 bool BrowserActionSetIconFunction::RunBrowserAction() { | 44 bool BrowserActionSetIconFunction::RunBrowserAction() { |
45 BinaryValue* binary = NULL; | 45 BinaryValue* binary = NULL; |
46 EXTENSION_FUNCTION_VALIDATE(details_->GetBinary(L"imageData", &binary)); | 46 EXTENSION_FUNCTION_VALIDATE(details_->GetBinary(L"imageData", &binary)); |
47 IPC::Message bitmap_pickle(binary->GetBuffer(), binary->GetSize()); | 47 IPC::Message bitmap_pickle(binary->GetBuffer(), binary->GetSize()); |
48 void* iter = NULL; | 48 void* iter = NULL; |
49 SkBitmap bitmap; | 49 SkBitmap bitmap; |
(...skipping 26 matching lines...) Expand all Loading... |
76 for (size_t i = 0; i < arraysize(color_array); ++i) { | 76 for (size_t i = 0; i < arraysize(color_array); ++i) { |
77 EXTENSION_FUNCTION_VALIDATE(list->GetInteger(i, &color_array[i])); | 77 EXTENSION_FUNCTION_VALIDATE(list->GetInteger(i, &color_array[i])); |
78 } | 78 } |
79 | 79 |
80 SkColor color = SkColorSetARGB(color_array[3], color_array[0], color_array[1], | 80 SkColor color = SkColorSetARGB(color_array[3], color_array[0], color_array[1], |
81 color_array[2]); | 81 color_array[2]); |
82 browser_action_->SetBadgeBackgroundColor(tab_id_, color); | 82 browser_action_->SetBadgeBackgroundColor(tab_id_, color); |
83 | 83 |
84 return true; | 84 return true; |
85 } | 85 } |
OLD | NEW |