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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_actions_api.cc

Issue 10905005: Change browser/page action default icon defined in manifest to support hidpi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
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/base64.h" 9 #include "base/base64.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, kIconSizes[i].scale)); 455 icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, kIconSizes[i].scale));
456 } 456 }
457 } 457 }
458 458
459 extension_action_->SetIcon(tab_id_, gfx::Image(icon)); 459 extension_action_->SetIcon(tab_id_, gfx::Image(icon));
460 } else if (details_->GetInteger("iconIndex", &icon_index)) { 460 } else if (details_->GetInteger("iconIndex", &icon_index)) {
461 // If --enable-script-badges is on there might legitimately be an iconIndex 461 // If --enable-script-badges is on there might legitimately be an iconIndex
462 // set. Until we decide what to do with that, ignore. 462 // set. Until we decide what to do with that, ignore.
463 if (!GetExtension()->page_action()) 463 if (!GetExtension()->page_action())
464 return true; 464 return true;
465 if (icon_index < 0 || 465 if (!extension_action_->IsValidIconIndex(icon_index)) {
466 static_cast<size_t>(icon_index) >=
467 extension_action_->icon_paths()->size()) {
468 error_ = kIconIndexOutOfBounds; 466 error_ = kIconIndexOutOfBounds;
469 return false; 467 return false;
470 } 468 }
471 extension_action_->SetIcon(tab_id_, gfx::Image()); 469 extension_action_->SetIcon(tab_id_, gfx::Image());
472 extension_action_->SetIconIndex(tab_id_, icon_index); 470 extension_action_->SetIconIndex(tab_id_, icon_index);
473 } else { 471 } else {
474 EXTENSION_FUNCTION_VALIDATE(false); 472 EXTENSION_FUNCTION_VALIDATE(false);
475 } 473 }
476 NotifyChange(); 474 NotifyChange();
477 return true; 475 return true;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { 551 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() {
554 ListValue* list = new ListValue(); 552 ListValue* list = new ListValue();
555 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); 553 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_);
556 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); 554 list->Append(Value::CreateIntegerValue(SkColorGetR(color)));
557 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); 555 list->Append(Value::CreateIntegerValue(SkColorGetG(color)));
558 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); 556 list->Append(Value::CreateIntegerValue(SkColorGetB(color)));
559 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); 557 list->Append(Value::CreateIntegerValue(SkColorGetA(color)));
560 SetResult(list); 558 SetResult(list);
561 return true; 559 return true;
562 } 560 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698