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

Side by Side Diff: chrome/browser/views/location_bar_view.cc

Issue 337035: Replace ExtensionAction with ExtensionAction2. (Closed)
Patch Set: Remove todo 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
« no previous file with comments | « chrome/browser/views/location_bar_view.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/views/location_bar_view.h" 5 #include "chrome/browser/views/location_bar_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 void LocationBarView::PageActionWithBadgeView::Layout() { 104 void LocationBarView::PageActionWithBadgeView::Layout() {
105 image_view_->SetBounds(0, 0, width(), height()); 105 image_view_->SetBounds(0, 0, width(), height());
106 } 106 }
107 107
108 void LocationBarView::PageActionWithBadgeView::PaintChildren( 108 void LocationBarView::PageActionWithBadgeView::PaintChildren(
109 gfx::Canvas* canvas) { 109 gfx::Canvas* canvas) {
110 View::PaintChildren(canvas); 110 View::PaintChildren(canvas);
111 111
112 ExtensionAction2* action = image_view_->page_action(); 112 ExtensionAction* action = image_view_->page_action();
113 int tab_id = image_view_->current_tab_id(); 113 int tab_id = image_view_->current_tab_id();
114 if (tab_id < 0) 114 if (tab_id < 0)
115 return; 115 return;
116 116
117 action->PaintBadge(canvas, gfx::Rect(width(), height()), tab_id); 117 action->PaintBadge(canvas, gfx::Rect(width(), height()), tab_id);
118 } 118 }
119 119
120 void LocationBarView::PageActionWithBadgeView::UpdateVisibility( 120 void LocationBarView::PageActionWithBadgeView::UpdateVisibility(
121 TabContents* contents, const GURL& url) { 121 TabContents* contents, const GURL& url) {
122 image_view_->UpdateVisibility(contents, url); 122 image_view_->UpdateVisibility(contents, url);
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 if (!page_action_views_.empty()) { 677 if (!page_action_views_.empty()) {
678 for (size_t i = 0; i < page_action_views_.size(); ++i) 678 for (size_t i = 0; i < page_action_views_.size(); ++i)
679 RemoveChildView(page_action_views_[i]); 679 RemoveChildView(page_action_views_[i]);
680 STLDeleteContainerPointers(page_action_views_.begin(), 680 STLDeleteContainerPointers(page_action_views_.begin(),
681 page_action_views_.end()); 681 page_action_views_.end());
682 page_action_views_.clear(); 682 page_action_views_.clear();
683 } 683 }
684 } 684 }
685 685
686 void LocationBarView::RefreshPageActionViews() { 686 void LocationBarView::RefreshPageActionViews() {
687 std::vector<ExtensionAction2*> page_actions; 687 std::vector<ExtensionAction*> page_actions;
688 ExtensionsService* service = profile_->GetExtensionsService(); 688 ExtensionsService* service = profile_->GetExtensionsService();
689 if (!service) 689 if (!service)
690 return; 690 return;
691 691
692 for (size_t i = 0; i < service->extensions()->size(); ++i) { 692 for (size_t i = 0; i < service->extensions()->size(); ++i) {
693 if (service->extensions()->at(i)->page_action()) 693 if (service->extensions()->at(i)->page_action())
694 page_actions.push_back(service->extensions()->at(i)->page_action()); 694 page_actions.push_back(service->extensions()->at(i)->page_action());
695 } 695 }
696 696
697 // On startup we sometimes haven't loaded any extensions. This makes sure 697 // On startup we sometimes haven't loaded any extensions. This makes sure
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 ShowInfoBubbleImpl(text, GetColor( 1223 ShowInfoBubbleImpl(text, GetColor(
1224 model_->GetSecurityLevel() == ToolbarModel::SECURE, 1224 model_->GetSecurityLevel() == ToolbarModel::SECURE,
1225 SECURITY_INFO_BUBBLE_TEXT)); 1225 SECURITY_INFO_BUBBLE_TEXT));
1226 } 1226 }
1227 1227
1228 // PageActionImageView---------------------------------------------------------- 1228 // PageActionImageView----------------------------------------------------------
1229 1229
1230 LocationBarView::PageActionImageView::PageActionImageView( 1230 LocationBarView::PageActionImageView::PageActionImageView(
1231 LocationBarView* owner, 1231 LocationBarView* owner,
1232 Profile* profile, 1232 Profile* profile,
1233 ExtensionAction2* page_action, 1233 ExtensionAction* page_action,
1234 const BubblePositioner* bubble_positioner) 1234 const BubblePositioner* bubble_positioner)
1235 : LocationBarImageView(bubble_positioner), 1235 : LocationBarImageView(bubble_positioner),
1236 owner_(owner), 1236 owner_(owner),
1237 profile_(profile), 1237 profile_(profile),
1238 page_action_(page_action), 1238 page_action_(page_action),
1239 current_tab_id_(-1) { 1239 current_tab_id_(-1) {
1240 Extension* extension = profile->GetExtensionsService()->GetExtensionById( 1240 Extension* extension = profile->GetExtensionsService()->GetExtensionById(
1241 page_action->extension_id()); 1241 page_action->extension_id());
1242 DCHECK(extension); 1242 DCHECK(extension);
1243 1243
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 } 1400 }
1401 1401
1402 int LocationBarView::PageActionVisibleCount() { 1402 int LocationBarView::PageActionVisibleCount() {
1403 int result = 0; 1403 int result = 0;
1404 for (size_t i = 0; i < page_action_views_.size(); i++) { 1404 for (size_t i = 0; i < page_action_views_.size(); i++) {
1405 if (page_action_views_[i]->IsVisible()) 1405 if (page_action_views_[i]->IsVisible())
1406 ++result; 1406 ++result;
1407 } 1407 }
1408 return result; 1408 return result;
1409 } 1409 }
OLDNEW
« no previous file with comments | « chrome/browser/views/location_bar_view.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698