OLD | NEW |
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/api/extension_action/extension_actions_api.h
" | 5 #include "chrome/browser/extensions/api/extension_action/extension_actions_api.h
" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 CHECK(tab_id_value->GetAsInteger(&tab_id_)); | 84 CHECK(tab_id_value->GetAsInteger(&tab_id_)); |
85 break; | 85 break; |
86 default: | 86 default: |
87 // Boom. | 87 // Boom. |
88 EXTENSION_FUNCTION_VALIDATE(false); | 88 EXTENSION_FUNCTION_VALIDATE(false); |
89 } | 89 } |
90 } | 90 } |
91 break; | 91 break; |
92 } | 92 } |
93 | 93 |
| 94 case Value::TYPE_NULL: |
| 95 // The tabId might be an optional argument. |
| 96 break; |
| 97 |
94 default: | 98 default: |
95 EXTENSION_FUNCTION_VALIDATE(false); | 99 EXTENSION_FUNCTION_VALIDATE(false); |
96 } | 100 } |
97 } | 101 } |
98 | 102 |
99 // Find the TabContents that contains this tab id if one is required. | 103 // Find the TabContents that contains this tab id if one is required. |
100 if (tab_id_ == ExtensionAction::kDefaultTabId) { | 104 if (tab_id_ == ExtensionAction::kDefaultTabId) { |
101 EXTENSION_FUNCTION_VALIDATE(GetExtension()->browser_action()); | 105 EXTENSION_FUNCTION_VALIDATE(GetExtension()->browser_action()); |
102 } else { | 106 } else { |
103 ExtensionTabUtil::GetTabById( | 107 ExtensionTabUtil::GetTabById( |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { | 308 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { |
305 ListValue* list = new ListValue(); | 309 ListValue* list = new ListValue(); |
306 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); | 310 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); |
307 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); | 311 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); |
308 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); | 312 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); |
309 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); | 313 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); |
310 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); | 314 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); |
311 SetResult(list); | 315 SetResult(list); |
312 return true; | 316 return true; |
313 } | 317 } |
OLD | NEW |