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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_page_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: cocoa 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_page_actions_ api.h" 5 #include "chrome/browser/extensions/api/extension_action/extension_page_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 "chrome/browser/extensions/api/extension_action/extension_page_actions_ api_constants.h" 10 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_ api_constants.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 &icon_id)); 63 &icon_id));
64 } 64 }
65 } 65 }
66 66
67 ExtensionAction* page_action = GetExtension()->page_action(); 67 ExtensionAction* page_action = GetExtension()->page_action();
68 if (!page_action) { 68 if (!page_action) {
69 error_ = kNoPageActionError; 69 error_ = kNoPageActionError;
70 return false; 70 return false;
71 } 71 }
72 72
73 if (icon_id < 0 || 73 if (!page_action->IsValidIconIndex(icon_id)) {
74 static_cast<size_t>(icon_id) >= page_action->icon_paths()->size()) {
75 error_ = (icon_id == 0) ? kNoIconSpecified : kIconIndexOutOfBounds; 74 error_ = (icon_id == 0) ? kNoIconSpecified : kIconIndexOutOfBounds;
76 return false; 75 return false;
77 } 76 }
78 77
79 // Find the TabContents that contains this tab id. 78 // Find the TabContents that contains this tab id.
80 TabContents* contents = NULL; 79 TabContents* contents = NULL;
81 bool result = ExtensionTabUtil::GetTabById( 80 bool result = ExtensionTabUtil::GetTabById(
82 tab_id, profile(), include_incognito(), NULL, NULL, &contents, NULL); 81 tab_id, profile(), include_incognito(), NULL, NULL, &contents, NULL);
83 if (!result || !contents) { 82 if (!result || !contents) {
84 error_ = ExtensionErrorUtils::FormatErrorMessage( 83 error_ = ExtensionErrorUtils::FormatErrorMessage(
(...skipping 19 matching lines...) Expand all
104 return true; 103 return true;
105 } 104 }
106 105
107 bool EnablePageActionsFunction::RunImpl() { 106 bool EnablePageActionsFunction::RunImpl() {
108 return SetPageActionEnabled(true); 107 return SetPageActionEnabled(true);
109 } 108 }
110 109
111 bool DisablePageActionsFunction::RunImpl() { 110 bool DisablePageActionsFunction::RunImpl() {
112 return SetPageActionEnabled(false); 111 return SetPageActionEnabled(false);
113 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698