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

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

Issue 9447084: Refactor Pickle Read methods to use higher performance PickleIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile (racing with incoming CLs) Created 8 years, 9 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) 2011 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/extension_browser_actions_api.h" 5 #include "chrome/browser/extensions/extension_browser_actions_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
(...skipping 30 matching lines...) Expand all
42 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, 42 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED,
43 content::Source<ExtensionAction>(browser_action_), 43 content::Source<ExtensionAction>(browser_action_),
44 content::NotificationService::NoDetails()); 44 content::NotificationService::NoDetails());
45 return true; 45 return true;
46 } 46 }
47 47
48 bool BrowserActionSetIconFunction::RunBrowserAction() { 48 bool BrowserActionSetIconFunction::RunBrowserAction() {
49 base::BinaryValue* binary = NULL; 49 base::BinaryValue* binary = NULL;
50 EXTENSION_FUNCTION_VALIDATE(details_->GetBinary("imageData", &binary)); 50 EXTENSION_FUNCTION_VALIDATE(details_->GetBinary("imageData", &binary));
51 IPC::Message bitmap_pickle(binary->GetBuffer(), binary->GetSize()); 51 IPC::Message bitmap_pickle(binary->GetBuffer(), binary->GetSize());
52 void* iter = NULL; 52 PickleIterator iter(bitmap_pickle);
53 SkBitmap bitmap; 53 SkBitmap bitmap;
54 EXTENSION_FUNCTION_VALIDATE( 54 EXTENSION_FUNCTION_VALIDATE(
55 IPC::ReadParam(&bitmap_pickle, &iter, &bitmap)); 55 IPC::ReadParam(&bitmap_pickle, &iter, &bitmap));
56 browser_action_->SetIcon(tab_id_, bitmap); 56 browser_action_->SetIcon(tab_id_, bitmap);
57 return true; 57 return true;
58 } 58 }
59 59
60 bool BrowserActionSetTitleFunction::RunBrowserAction() { 60 bool BrowserActionSetTitleFunction::RunBrowserAction() {
61 std::string title; 61 std::string title;
62 EXTENSION_FUNCTION_VALIDATE(details_->GetString("title", &title)); 62 EXTENSION_FUNCTION_VALIDATE(details_->GetString("title", &title));
(...skipping 29 matching lines...) Expand all
92 for (size_t i = 0; i < arraysize(color_array); ++i) { 92 for (size_t i = 0; i < arraysize(color_array); ++i) {
93 EXTENSION_FUNCTION_VALIDATE(list->GetInteger(i, &color_array[i])); 93 EXTENSION_FUNCTION_VALIDATE(list->GetInteger(i, &color_array[i]));
94 } 94 }
95 95
96 SkColor color = SkColorSetARGB(color_array[3], color_array[0], color_array[1], 96 SkColor color = SkColorSetARGB(color_array[3], color_array[0], color_array[1],
97 color_array[2]); 97 color_array[2]);
98 browser_action_->SetBadgeBackgroundColor(tab_id_, color); 98 browser_action_->SetBadgeBackgroundColor(tab_id_, color);
99 99
100 return true; 100 return true;
101 } 101 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/execute_code_in_tab_function.cc ('k') | chrome/browser/extensions/extension_messages_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698