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

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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 235 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
236 ContentSettingImageView* content_blocked_view = 236 ContentSettingImageView* content_blocked_view =
237 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); 237 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this);
238 content_setting_views_.push_back(content_blocked_view); 238 content_setting_views_.push_back(content_blocked_view);
239 AddChildView(content_blocked_view); 239 AddChildView(content_blocked_view);
240 content_blocked_view->SetVisible(false); 240 content_blocked_view->SetVisible(false);
241 } 241 }
242 242
243 if (extensions::switch_utils::IsActionBoxEnabled()) { 243 if (extensions::switch_utils::IsActionBoxEnabled()) {
244 action_box_button_view_ = new ActionBoxButtonView( 244 action_box_button_view_ = new ActionBoxButtonView(profile_, delegate_);
245 ExtensionSystem::Get(profile_)->extension_service());
246 AddChildView(action_box_button_view_); 245 AddChildView(action_box_button_view_);
247 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { 246 } else if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) {
248 // Note: condition above means that the star and ChromeToMobile icons are 247 // Note: condition above means that the star and ChromeToMobile icons are
249 // hidden in popups and in the app launcher. 248 // hidden in popups and in the app launcher.
250 star_view_ = new StarView(command_updater_); 249 star_view_ = new StarView(command_updater_);
251 AddChildView(star_view_); 250 AddChildView(star_view_);
252 star_view_->SetVisible(true); 251 star_view_->SetVisible(true);
253 252
254 // Also disable Chrome To Mobile for off-the-record and non-synced profiles, 253 // Also disable Chrome To Mobile for off-the-record and non-synced profiles,
255 // or if the feature is disabled by a command line flag or chrome://flags. 254 // or if the feature is disabled by a command line flag or chrome://flags.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 i != page_action_views_.end(); ++i) { 440 i != page_action_views_.end(); ++i) {
442 if ((*i)->image_view()->page_action() == page_action) 441 if ((*i)->image_view()->page_action() == page_action)
443 return *i; 442 return *i;
444 } 443 }
445 return NULL; 444 return NULL;
446 } 445 }
447 446
448 void LocationBarView::SetStarToggled(bool on) { 447 void LocationBarView::SetStarToggled(bool on) {
449 if (star_view_) 448 if (star_view_)
450 star_view_->SetToggled(on); 449 star_view_->SetToggled(on);
450 if (action_box_button_view_)
451 action_box_button_view_->SetBookmarkState(on);
451 } 452 }
452 453
453 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { 454 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
454 browser::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); 455 browser::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked);
455 } 456 }
456 457
457 void LocationBarView::ShowChromeToMobileBubble() { 458 void LocationBarView::ShowChromeToMobileBubble() {
458 Browser* browser = GetBrowserFromDelegate(delegate_); 459 Browser* browser = GetBrowserFromDelegate(delegate_);
459 browser::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser); 460 browser::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser);
460 } 461 }
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1376 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1376 int total_height = 1377 int total_height =
1377 use_preferred_size ? GetPreferredSize().height() : height(); 1378 use_preferred_size ? GetPreferredSize().height() : height();
1378 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1379 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1379 } 1380 }
1380 1381
1381 bool LocationBarView::HasValidSuggestText() const { 1382 bool LocationBarView::HasValidSuggestText() const {
1382 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1383 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1383 !suggested_text_view_->text().empty(); 1384 !suggested_text_view_->text().empty();
1384 } 1385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698