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

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

Issue 10917026: Switch Extensions::TabHelper to use WebContents, WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 void ExtensionActionFunction::NotifyBrowserActionChange() { 371 void ExtensionActionFunction::NotifyBrowserActionChange() {
372 content::NotificationService::current()->Notify( 372 content::NotificationService::current()->Notify(
373 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, 373 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED,
374 content::Source<ExtensionAction>(extension_action_), 374 content::Source<ExtensionAction>(extension_action_),
375 content::Details<Profile>(profile())); 375 content::Details<Profile>(profile()));
376 } 376 }
377 377
378 void ExtensionActionFunction::NotifyLocationBarChange() { 378 void ExtensionActionFunction::NotifyLocationBarChange() {
379 contents_->extension_tab_helper()->location_bar_controller()->NotifyChange(); 379 extensions::TabHelper::FromWebContents(contents_->web_contents())->
380 location_bar_controller()->NotifyChange();
380 } 381 }
381 382
382 // static 383 // static
383 bool ExtensionActionFunction::ParseCSSColorString( 384 bool ExtensionActionFunction::ParseCSSColorString(
384 const std::string& color_string, 385 const std::string& color_string,
385 SkColor* result) { 386 SkColor* result) {
386 std::string formatted_color = "#"; 387 std::string formatted_color = "#";
387 // Check the string for incorrect formatting. 388 // Check the string for incorrect formatting.
388 if (color_string[0] != '#') 389 if (color_string[0] != '#')
389 return false; 390 return false;
(...skipping 28 matching lines...) Expand all
418 419
419 bool ExtensionActionFunction::SetVisible(bool visible) { 420 bool ExtensionActionFunction::SetVisible(bool visible) {
420 extension_action_->SetAppearance( 421 extension_action_->SetAppearance(
421 tab_id_, visible ? ExtensionAction::ACTIVE : ExtensionAction::INVISIBLE); 422 tab_id_, visible ? ExtensionAction::ACTIVE : ExtensionAction::INVISIBLE);
422 NotifyChange(); 423 NotifyChange();
423 return true; 424 return true;
424 } 425 }
425 426
426 extensions::TabHelper& ExtensionActionFunction::tab_helper() const { 427 extensions::TabHelper& ExtensionActionFunction::tab_helper() const {
427 CHECK(contents_); 428 CHECK(contents_);
428 return *contents_->extension_tab_helper(); 429 return *extensions::TabHelper::FromWebContents(contents_->web_contents());
429 } 430 }
430 431
431 bool ExtensionActionShowFunction::RunExtensionAction() { 432 bool ExtensionActionShowFunction::RunExtensionAction() {
432 return SetVisible(true); 433 return SetVisible(true);
433 } 434 }
434 435
435 bool ExtensionActionHideFunction::RunExtensionAction() { 436 bool ExtensionActionHideFunction::RunExtensionAction() {
436 return SetVisible(false); 437 return SetVisible(false);
437 } 438 }
438 439
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { 554 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() {
554 ListValue* list = new ListValue(); 555 ListValue* list = new ListValue();
555 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); 556 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_);
556 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); 557 list->Append(Value::CreateIntegerValue(SkColorGetR(color)));
557 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); 558 list->Append(Value::CreateIntegerValue(SkColorGetG(color)));
558 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); 559 list->Append(Value::CreateIntegerValue(SkColorGetB(color)));
559 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); 560 list->Append(Value::CreateIntegerValue(SkColorGetA(color)));
560 SetResult(list); 561 SetResult(list);
561 return true; 562 return true;
562 } 563 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698