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

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, 4 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 LocationBarView::FadeAnimationObserver::~FadeAnimationObserver() { 156 LocationBarView::FadeAnimationObserver::~FadeAnimationObserver() {
157 } 157 }
158 158
159 void LocationBarView::FadeAnimationObserver::OnImplicitAnimationsCompleted() { 159 void LocationBarView::FadeAnimationObserver::OnImplicitAnimationsCompleted() {
160 location_bar_view_->CleanupFadeAnimation(); 160 location_bar_view_->CleanupFadeAnimation();
161 } 161 }
162 #endif // USE_AURA 162 #endif // USE_AURA
163 163
164 // LocationBarView ----------------------------------------------------------- 164 // LocationBarView -----------------------------------------------------------
165 165
166 LocationBarView::LocationBarView(Profile* profile, 166 LocationBarView::LocationBarView(Browser* browser,
167 Profile* profile,
167 CommandUpdater* command_updater, 168 CommandUpdater* command_updater,
168 ToolbarModel* model, 169 ToolbarModel* model,
169 Delegate* delegate, 170 Delegate* delegate,
170 chrome::search::SearchModel* search_model, 171 chrome::search::SearchModel* search_model,
171 Mode mode) 172 Mode mode)
172 : profile_(profile), 173 : browser_(browser),
174 profile_(profile),
173 command_updater_(command_updater), 175 command_updater_(command_updater),
174 model_(model), 176 model_(model),
175 delegate_(delegate), 177 delegate_(delegate),
176 search_model_(search_model), 178 search_model_(search_model),
177 disposition_(CURRENT_TAB), 179 disposition_(CURRENT_TAB),
178 transition_(content::PageTransitionFromInt( 180 transition_(content::PageTransitionFromInt(
179 content::PAGE_TRANSITION_TYPED | 181 content::PAGE_TRANSITION_TYPED |
180 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), 182 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)),
181 location_icon_view_(NULL), 183 location_icon_view_(NULL),
182 ev_bubble_view_(NULL), 184 ev_bubble_view_(NULL),
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 ContentSettingImageView* content_blocked_view = 273 ContentSettingImageView* content_blocked_view =
272 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); 274 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this);
273 content_setting_views_.push_back(content_blocked_view); 275 content_setting_views_.push_back(content_blocked_view);
274 AddChildView(content_blocked_view); 276 AddChildView(content_blocked_view);
275 content_blocked_view->SetVisible(false); 277 content_blocked_view->SetVisible(false);
276 } 278 }
277 279
278 zoom_view_ = new ZoomView(model_); 280 zoom_view_ = new ZoomView(model_);
279 AddChildView(zoom_view_); 281 AddChildView(zoom_view_);
280 282
281 if (extensions::switch_utils::IsActionBoxEnabled()) { 283 if (extensions::switch_utils::IsActionBoxEnabled() && browser_) {
282 action_box_button_view_ = new ActionBoxButtonView( 284 action_box_button_view_ = new ActionBoxButtonView(browser_, profile_);
283 extensions::ExtensionSystem::Get(profile_)->extension_service());
284 AddChildView(action_box_button_view_); 285 AddChildView(action_box_button_view_);
285 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { 286 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) {
286 // Note: condition above means that the star and ChromeToMobile icons are 287 // Note: condition above means that the star and ChromeToMobile icons are
287 // hidden in popups and in the app launcher. 288 // hidden in popups and in the app launcher.
288 star_view_ = new StarView(command_updater_); 289 star_view_ = new StarView(command_updater_);
289 AddChildView(star_view_); 290 AddChildView(star_view_);
290 291
291 // Add the metro pin view, if this is windows and we are running in Metro 292 // Add the metro pin view, if this is windows and we are running in Metro
292 // mode. 293 // mode.
293 #if defined(OS_WIN) 294 #if defined(OS_WIN)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 i != page_action_views_.end(); ++i) { 503 i != page_action_views_.end(); ++i) {
503 if ((*i)->image_view()->page_action() == page_action) 504 if ((*i)->image_view()->page_action() == page_action)
504 return *i; 505 return *i;
505 } 506 }
506 return NULL; 507 return NULL;
507 } 508 }
508 509
509 void LocationBarView::SetStarToggled(bool on) { 510 void LocationBarView::SetStarToggled(bool on) {
510 if (star_view_) 511 if (star_view_)
511 star_view_->SetToggled(on); 512 star_view_->SetToggled(on);
513 if (action_box_button_view_)
514 action_box_button_view_->set_starred(on);
512 } 515 }
513 516
514 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { 517 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
515 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); 518 chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked);
516 } 519 }
517 520
518 void LocationBarView::SetMetroPinnedState(bool is_pinned) { 521 void LocationBarView::SetMetroPinnedState(bool is_pinned) {
519 if (metro_pin_view_) 522 if (metro_pin_view_)
520 metro_pin_view_->SetIsPinned(is_pinned); 523 metro_pin_view_->SetIsPinned(is_pinned);
521 } 524 }
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 } 1532 }
1530 1533
1531 void LocationBarView::CleanupFadeAnimation() { 1534 void LocationBarView::CleanupFadeAnimation() {
1532 // Since we're no longer animating we don't need our layer. 1535 // Since we're no longer animating we don't need our layer.
1533 SetPaintToLayer(false); 1536 SetPaintToLayer(false);
1534 // Bubble labels don't need a transparent background anymore. 1537 // Bubble labels don't need a transparent background anymore.
1535 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1538 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1536 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1539 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1537 } 1540 }
1538 #endif // USE_AURA 1541 #endif // USE_AURA
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698