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

Side by Side Diff: chrome/browser/extensions/extension_page_actions_module.cc

Issue 306059: Merge 29556 - Revert "Revert 29457, because this is making ExtensionBrowserTe... (Closed) Base URL: svn://chrome-svn/chrome/branches/223/src/
Patch Set: Created 11 years, 1 month 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
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/extensions/extension_page_actions_module.cc:r29556
OLDNEW
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_page_actions_module.h" 5 #include "chrome/browser/extensions/extension_page_actions_module.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/browser_list.h" 9 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return false; 205 return false;
206 206
207 ListValue* color_value; 207 ListValue* color_value;
208 EXTENSION_FUNCTION_VALIDATE(args->GetList(L"color", &color_value)); 208 EXTENSION_FUNCTION_VALIDATE(args->GetList(L"color", &color_value));
209 EXTENSION_FUNCTION_VALIDATE(color_value->GetSize() == 4); 209 EXTENSION_FUNCTION_VALIDATE(color_value->GetSize() == 4);
210 210
211 int color_array[4] = {0}; 211 int color_array[4] = {0};
212 for (size_t i = 0; i < arraysize(color_array); ++i) 212 for (size_t i = 0; i < arraysize(color_array); ++i)
213 EXTENSION_FUNCTION_VALIDATE(color_value->GetInteger(i, &color_array[i])); 213 EXTENSION_FUNCTION_VALIDATE(color_value->GetInteger(i, &color_array[i]));
214 214
215 SkColor color = SkColorSetARGB(color_array[0], color_array[1], color_array[2], 215 SkColor color = SkColorSetARGB(color_array[3], color_array[0], color_array[1],
216 color_array[3]); 216 color_array[2]);
217 state_->set_badge_background_color(color); 217 state_->set_badge_background_color(color);
218 contents_->PageActionStateChanged(); 218 contents_->PageActionStateChanged();
219 return true; 219 return true;
220 } 220 }
221 221
222 bool PageActionSetBadgeTextColorFunction::RunImpl() { 222 bool PageActionSetBadgeTextColorFunction::RunImpl() {
223 EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); 223 EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY));
224 const DictionaryValue* args = static_cast<const DictionaryValue*>(args_); 224 const DictionaryValue* args = static_cast<const DictionaryValue*>(args_);
225 225
226 int tab_id; 226 int tab_id;
227 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id)); 227 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id));
228 if (!InitCommon(tab_id)) 228 if (!InitCommon(tab_id))
229 return false; 229 return false;
230 230
231 ListValue* color_value; 231 ListValue* color_value;
232 EXTENSION_FUNCTION_VALIDATE(args->GetList(L"color", &color_value)); 232 EXTENSION_FUNCTION_VALIDATE(args->GetList(L"color", &color_value));
233 EXTENSION_FUNCTION_VALIDATE(color_value->GetSize() == 4); 233 EXTENSION_FUNCTION_VALIDATE(color_value->GetSize() == 4);
234 234
235 int color_array[4] = {0}; 235 int color_array[4] = {0};
236 for (size_t i = 0; i < arraysize(color_array); ++i) 236 for (size_t i = 0; i < arraysize(color_array); ++i)
237 EXTENSION_FUNCTION_VALIDATE(color_value->GetInteger(i, &color_array[i])); 237 EXTENSION_FUNCTION_VALIDATE(color_value->GetInteger(i, &color_array[i]));
238 238
239 // TODO(mpcomplete): implement text coloring. 239 SkColor color = SkColorSetARGB(color_array[3], color_array[0], color_array[1],
240 color_array[2]);
241 state_->set_badge_text_color(color);
242 contents_->PageActionStateChanged();
240 return true; 243 return true;
241 } 244 }
242 245
243 bool PageActionSetBadgeTextFunction::RunImpl() { 246 bool PageActionSetBadgeTextFunction::RunImpl() {
244 EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); 247 EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY));
245 const DictionaryValue* args = static_cast<const DictionaryValue*>(args_); 248 const DictionaryValue* args = static_cast<const DictionaryValue*>(args_);
246 249
247 int tab_id; 250 int tab_id;
248 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id)); 251 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id));
249 if (!InitCommon(tab_id)) 252 if (!InitCommon(tab_id))
250 return false; 253 return false;
251 254
252 std::string text; 255 std::string text;
253 EXTENSION_FUNCTION_VALIDATE(args->GetString(L"text", &text)); 256 EXTENSION_FUNCTION_VALIDATE(args->GetString(L"text", &text));
254 257
255 state_->set_badge_text(text); 258 state_->set_badge_text(text);
256 contents_->PageActionStateChanged(); 259 contents_->PageActionStateChanged();
257 return true; 260 return true;
258 } 261 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browser_actions_api.cc ('k') | chrome/browser/gtk/location_bar_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698