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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 return false; | 175 return false; |
176 if (color_ints[i] > 255 || color_ints[i] < 0) | 176 if (color_ints[i] > 255 || color_ints[i] < 0) |
177 return false; | 177 return false; |
178 } | 178 } |
179 | 179 |
180 *result = SkColorSetARGB(255, color_ints[0], color_ints[1], color_ints[2]); | 180 *result = SkColorSetARGB(255, color_ints[0], color_ints[1], color_ints[2]); |
181 return true; | 181 return true; |
182 } | 182 } |
183 | 183 |
184 bool ExtensionActionFunction::SetVisible(bool visible) { | 184 bool ExtensionActionFunction::SetVisible(bool visible) { |
185 extension_action_->SetIsVisible(tab_id_, visible); | 185 extension_action_->SetAppearance( |
| 186 tab_id_, visible ? ExtensionAction::ACTIVE : ExtensionAction::INVISIBLE); |
186 NotifyChange(); | 187 NotifyChange(); |
187 return true; | 188 return true; |
188 } | 189 } |
189 | 190 |
190 extensions::TabHelper& ExtensionActionFunction::tab_helper() const { | 191 extensions::TabHelper& ExtensionActionFunction::tab_helper() const { |
191 CHECK(contents_); | 192 CHECK(contents_); |
192 return *contents_->extension_tab_helper(); | 193 return *contents_->extension_tab_helper(); |
193 } | 194 } |
194 | 195 |
195 bool ExtensionActionShowFunction::RunExtensionAction() { | 196 bool ExtensionActionShowFunction::RunExtensionAction() { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { | 309 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { |
309 ListValue* list = new ListValue(); | 310 ListValue* list = new ListValue(); |
310 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); | 311 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); |
311 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); | 312 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); |
312 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); | 313 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); |
313 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); | 314 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); |
314 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); | 315 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); |
315 SetResult(list); | 316 SetResult(list); |
316 return true; | 317 return true; |
317 } | 318 } |
OLD | NEW |