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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 10406016: Implement Action Box button (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
===================================================================
--- chrome/browser/ui/views/location_bar/location_bar_view.cc (revision 137178)
+++ chrome/browser/ui/views/location_bar/location_bar_view.cc (working copy)
@@ -28,6 +28,7 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
+#include "chrome/browser/ui/views/location_bar/action_box_button_view.h"
#include "chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h"
#include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
#include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
@@ -40,6 +41,7 @@
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/extension_switch_utils.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -142,6 +144,7 @@
#endif
keyword_hint_view_(NULL),
star_view_(NULL),
+ action_box_button_view_(NULL),
chrome_to_mobile_view_(NULL),
mode_(mode),
show_focus_rect_(false),
@@ -229,8 +232,11 @@
content_blocked_view->SetVisible(false);
}
+ bool action_box_enabled = extensions::switch_utils::IsActionBoxEnabled();
+
// Hide the star and Chrome To Mobile icons in popups and in the app launcher.
- if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) {
+ if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL) &&
+ !action_box_enabled) {
star_view_ = new StarView(command_updater_);
AddChildView(star_view_);
star_view_->SetVisible(true);
@@ -248,6 +254,12 @@
}
}
+ if (action_box_enabled) {
+ action_box_button_view_ = new ActionBoxButtonView(command_updater_);
+ AddChildView(action_box_button_view_);
+ action_box_button_view_->SetVisible(true);
sky 2012/05/17 21:21:07 visible is the default.
yefimt 2012/05/17 22:42:52 Done.
+ }
+
// Initialize the location entry. We do this to avoid a black flash which is
// visible when the location entry has just been initialized.
Update(NULL);
@@ -567,6 +579,9 @@
if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible())
entry_width -= chrome_to_mobile_view_->GetPreferredSize().width() +
GetItemPadding();
+ if (action_box_button_view_ && action_box_button_view_->visible())
+ entry_width -= action_box_button_view_->GetPreferredSize().width() +
+ GetItemPadding();
for (PageActionViews::const_iterator i(page_action_views_.begin());
i != page_action_views_.end(); ++i) {
if ((*i)->visible())
@@ -643,6 +658,14 @@
offset -= GetItemPadding();
}
+ if (action_box_button_view_ && action_box_button_view_->visible()) {
sky 2012/05/17 21:21:07 You always make it visible, so no need for the vis
yefimt 2012/05/17 22:42:52 Done.
+ int button_width = action_box_button_view_->GetPreferredSize().width();
+ offset -= button_width;
+ action_box_button_view_->SetBounds(offset, location_y, button_width,
+ location_height);
+ offset -= GetItemPadding();
+ }
+
for (PageActionViews::const_iterator i(page_action_views_.begin());
i != page_action_views_.end(); ++i) {
if ((*i)->visible()) {

Powered by Google App Engine
This is Rietveld 408576698