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

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

Issue 10533086: Action box menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Action box menu Created 8 years, 5 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/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 LocationBarView::FadeAnimationObserver::~FadeAnimationObserver() { 151 LocationBarView::FadeAnimationObserver::~FadeAnimationObserver() {
152 } 152 }
153 153
154 void LocationBarView::FadeAnimationObserver::OnImplicitAnimationsCompleted() { 154 void LocationBarView::FadeAnimationObserver::OnImplicitAnimationsCompleted() {
155 location_bar_view_->CleanupFadeAnimation(); 155 location_bar_view_->CleanupFadeAnimation();
156 } 156 }
157 #endif // USE_AURA 157 #endif // USE_AURA
158 158
159 // LocationBarView ----------------------------------------------------------- 159 // LocationBarView -----------------------------------------------------------
160 160
161 LocationBarView::LocationBarView(Profile* profile, 161 LocationBarView::LocationBarView(Browser* browser,
162 Profile* profile,
162 CommandUpdater* command_updater, 163 CommandUpdater* command_updater,
163 ToolbarModel* model, 164 ToolbarModel* model,
164 Delegate* delegate, 165 Delegate* delegate,
165 chrome::search::SearchModel* search_model, 166 chrome::search::SearchModel* search_model,
166 Mode mode) 167 Mode mode)
167 : profile_(profile), 168 : browser_(browser),
169 profile_(profile),
168 command_updater_(command_updater), 170 command_updater_(command_updater),
169 model_(model), 171 model_(model),
170 delegate_(delegate), 172 delegate_(delegate),
171 search_model_(search_model), 173 search_model_(search_model),
172 disposition_(CURRENT_TAB), 174 disposition_(CURRENT_TAB),
173 transition_(content::PageTransitionFromInt( 175 transition_(content::PageTransitionFromInt(
174 content::PAGE_TRANSITION_TYPED | 176 content::PAGE_TRANSITION_TYPED |
175 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), 177 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)),
176 location_icon_view_(NULL), 178 location_icon_view_(NULL),
177 ev_bubble_view_(NULL), 179 ev_bubble_view_(NULL),
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 ContentSettingImageView* content_blocked_view = 268 ContentSettingImageView* content_blocked_view =
267 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); 269 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this);
268 content_setting_views_.push_back(content_blocked_view); 270 content_setting_views_.push_back(content_blocked_view);
269 AddChildView(content_blocked_view); 271 AddChildView(content_blocked_view);
270 content_blocked_view->SetVisible(false); 272 content_blocked_view->SetVisible(false);
271 } 273 }
272 274
273 zoom_view_ = new ZoomView(model_); 275 zoom_view_ = new ZoomView(model_);
274 AddChildView(zoom_view_); 276 AddChildView(zoom_view_);
275 277
276 if (extensions::switch_utils::IsActionBoxEnabled()) { 278 if (extensions::switch_utils::IsActionBoxEnabled() && browser_) {
277 action_box_button_view_ = new ActionBoxButtonView( 279 action_box_button_view_ = new ActionBoxButtonView(browser_, profile_);
278 extensions::ExtensionSystem::Get(profile_)->extension_service());
279 AddChildView(action_box_button_view_); 280 AddChildView(action_box_button_view_);
280 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { 281 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) {
281 // Note: condition above means that the star and ChromeToMobile icons are 282 // Note: condition above means that the star and ChromeToMobile icons are
282 // hidden in popups and in the app launcher. 283 // hidden in popups and in the app launcher.
283 star_view_ = new StarView(command_updater_); 284 star_view_ = new StarView(command_updater_);
284 AddChildView(star_view_); 285 AddChildView(star_view_);
285 star_view_->SetVisible(true); 286 star_view_->SetVisible(true);
286 287
287 // Also disable Chrome To Mobile for off-the-record and non-synced profiles, 288 // Also disable Chrome To Mobile for off-the-record and non-synced profiles,
288 // or if the feature is disabled by a command line flag or chrome://flags. 289 // or if the feature is disabled by a command line flag or chrome://flags.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 i != page_action_views_.end(); ++i) { 490 i != page_action_views_.end(); ++i) {
490 if ((*i)->image_view()->page_action() == page_action) 491 if ((*i)->image_view()->page_action() == page_action)
491 return *i; 492 return *i;
492 } 493 }
493 return NULL; 494 return NULL;
494 } 495 }
495 496
496 void LocationBarView::SetStarToggled(bool on) { 497 void LocationBarView::SetStarToggled(bool on) {
497 if (star_view_) 498 if (star_view_)
498 star_view_->SetToggled(on); 499 star_view_->SetToggled(on);
500 if (action_box_button_view_)
501 action_box_button_view_->set_bookmark_state(on);
499 } 502 }
500 503
501 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { 504 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
502 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); 505 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked);
503 } 506 }
504 507
505 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { 508 void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) {
506 zoom_view_->SetZoomIconTooltipPercent(zoom_percent); 509 zoom_view_->SetZoomIconTooltipPercent(zoom_percent);
507 } 510 }
508 511
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 } 1498 }
1496 1499
1497 void LocationBarView::CleanupFadeAnimation() { 1500 void LocationBarView::CleanupFadeAnimation() {
1498 // Since we're no longer animating we don't need our layer. 1501 // Since we're no longer animating we don't need our layer.
1499 SetPaintToLayer(false); 1502 SetPaintToLayer(false);
1500 // Bubble labels don't need a transparent background anymore. 1503 // Bubble labels don't need a transparent background anymore.
1501 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1504 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1502 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1505 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1503 } 1506 }
1504 #endif // USE_AURA 1507 #endif // USE_AURA
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698