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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 670463004: Make a platform-independent ToolbarActionViewController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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/ui/views/location_bar/page_action_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_action.h" 8 #include "chrome/browser/extensions/extension_action.h"
9 #include "chrome/browser/platform_util.h" 9 #include "chrome/browser/platform_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void PageActionImageView::PaintChildren(gfx::Canvas* canvas, 110 void PageActionImageView::PaintChildren(gfx::Canvas* canvas,
111 const views::CullSet& cull_set) { 111 const views::CullSet& cull_set) {
112 View::PaintChildren(canvas, cull_set); 112 View::PaintChildren(canvas, cull_set);
113 int tab_id = SessionTabHelper::IdForTab(GetCurrentWebContents()); 113 int tab_id = SessionTabHelper::IdForTab(GetCurrentWebContents());
114 if (tab_id >= 0) { 114 if (tab_id >= 0) {
115 view_controller_->extension_action()->PaintBadge( 115 view_controller_->extension_action()->PaintBadge(
116 canvas, GetLocalBounds(), tab_id); 116 canvas, GetLocalBounds(), tab_id);
117 } 117 }
118 } 118 }
119 119
120 void PageActionImageView::OnIconUpdated() { 120 void PageActionImageView::UpdateState() {
121 UpdateVisibility(GetCurrentWebContents()); 121 UpdateVisibility(GetCurrentWebContents());
122 } 122 }
123 123
124 views::View* PageActionImageView::GetAsView() { 124 views::View* PageActionImageView::GetAsView() {
125 return this; 125 return this;
126 } 126 }
127 127
128 bool PageActionImageView::IsShownInMenu() { 128 bool PageActionImageView::IsShownInMenu() {
129 return false; 129 return false;
130 } 130 }
131 131
132 views::FocusManager* PageActionImageView::GetFocusManagerForAccelerator() { 132 views::FocusManager* PageActionImageView::GetFocusManagerForAccelerator() {
133 return owner_->GetFocusManager(); 133 return owner_->GetFocusManager();
134 } 134 }
135 135
136 views::Widget* PageActionImageView::GetParentForContextMenu() { 136 views::Widget* PageActionImageView::GetParentForContextMenu() {
137 return GetWidget(); 137 return GetWidget();
138 } 138 }
139 139
140 ExtensionActionViewController* 140 ToolbarActionViewController*
141 PageActionImageView::GetPreferredPopupViewController() { 141 PageActionImageView::GetPreferredPopupViewController() {
142 return view_controller_.get(); 142 return view_controller_.get();
143 } 143 }
144 144
145 views::View* PageActionImageView::GetReferenceViewForPopup() { 145 views::View* PageActionImageView::GetReferenceViewForPopup() {
146 return this; 146 return this;
147 } 147 }
148 148
149 views::MenuButton* PageActionImageView::GetContextMenuButton() { 149 views::MenuButton* PageActionImageView::GetContextMenuButton() {
150 return NULL; // No menu button for page action views. 150 return NULL; // No menu button for page action views.
151 } 151 }
152 152
153 content::WebContents* PageActionImageView::GetCurrentWebContents() const { 153 content::WebContents* PageActionImageView::GetCurrentWebContents() const {
154 return owner_->GetWebContents(); 154 return owner_->GetWebContents();
155 } 155 }
156 156
157 void PageActionImageView::HideActivePopup() { 157 void PageActionImageView::HideActivePopup() {
158 // The only popup that will be active is this popup. 158 // The only popup that will be active is this popup.
159 view_controller_->HidePopup(); 159 view_controller_->HidePopup();
160 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698