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

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

Issue 10885024: Integrate Chrome To Mobile with Action Box UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nil/NULL checks in ChromeToMobileBubbleController. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 48b21263113e59dbd0dbe4500ba472990f58d257..531671e718d0d0c4ec42df971a47ece875d462d8 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -38,7 +38,6 @@
#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"
#include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
@@ -192,7 +191,6 @@ LocationBarView::LocationBarView(Browser* browser,
zoom_view_(NULL),
star_view_(NULL),
action_box_button_view_(NULL),
- chrome_to_mobile_view_(NULL),
mode_(mode),
show_focus_rect_(false),
template_url_service_(NULL),
@@ -284,21 +282,11 @@ void LocationBarView::Init(views::View* popup_parent_view) {
AddChildView(zoom_view_);
if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) {
- // Note: condition above means that the star and ChromeToMobile icons are
- // hidden in popups and in the app launcher.
+ // Note: condition above means that the star icon is hidden in popups and in
+ // the app launcher.
star_view_ = new StarView(command_updater_);
AddChildView(star_view_);
star_view_->SetVisible(true);
-
- // Disable Chrome To Mobile for off-the-record and non-synced profiles,
- // or if the feature is disabled by a command line flag or chrome://flags.
- if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible() &&
- ChromeToMobileService::IsChromeToMobileEnabled()) {
- chrome_to_mobile_view_ = new ChromeToMobileView(this, command_updater_);
- AddChildView(chrome_to_mobile_view_);
- chrome_to_mobile_view_->SetVisible(
- ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles());
- }
}
if (ActionBoxButtonView::IsActionBoxEnabled() && browser_) {
action_box_button_view_ = new ActionBoxButtonView(browser_, profile_);
@@ -418,7 +406,8 @@ void LocationBarView::Update(const WebContents* tab_for_state_restoring) {
if (star_view_ && !ActionBoxButtonView::IsActionBoxEnabled())
star_view_->SetVisible(star_enabled);
- bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() &&
+ bool enabled = ChromeToMobileService::IsChromeToMobileEnabled() &&
+ !model_->input_in_progress() &&
ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles();
command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
@@ -544,8 +533,8 @@ void LocationBarView::RefreshZoomView() {
}
void LocationBarView::ShowChromeToMobileBubble() {
- Browser* browser = GetBrowserFromDelegate(delegate_);
- chrome::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser);
+ chrome::ShowChromeToMobileBubbleView(action_box_button_view_,
+ GetBrowserFromDelegate(delegate_));
}
gfx::Point LocationBarView::GetLocationEntryOrigin() const {
@@ -681,10 +670,6 @@ void LocationBarView::Layout() {
if (star_view_ && star_view_->visible())
entry_width -= star_view_->GetPreferredSize().width() + GetItemPadding();
- if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible()) {
- entry_width -= chrome_to_mobile_view_->GetPreferredSize().width() +
- GetItemPadding();
- }
int action_box_button_width = location_height;
if (action_box_button_view_)
entry_width -= action_box_button_width + GetItemPadding();
@@ -703,8 +688,8 @@ void LocationBarView::Layout() {
// The gap between the edit and whatever is to its right is shortened.
entry_width += kEditInternalSpace;
- // Size the EV bubble after taking star/ChromeToMobile/page actions/content
- // settings out of |entry_width| so we won't take too much space.
+ // Size the EV bubble after taking star/page actions/content settings out of
+ // |entry_width| so we won't take too much space.
if (ev_bubble_width) {
// Try to elide the bubble to be no larger than half the total available
// space, but never elide it any smaller than 150 px.
@@ -767,16 +752,6 @@ void LocationBarView::Layout() {
offset -= GetItemPadding() - star_view_->GetBuiltInHorizontalPadding();
}
- if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible()) {
- offset += chrome_to_mobile_view_->GetBuiltInHorizontalPadding();
- int icon_width = chrome_to_mobile_view_->GetPreferredSize().width();
- offset -= icon_width;
- chrome_to_mobile_view_->SetBounds(offset, location_y,
- icon_width, location_height);
- offset -= GetItemPadding() -
- chrome_to_mobile_view_->GetBuiltInHorizontalPadding();
- }
-
for (PageActionViews::const_iterator i(page_action_views_.begin());
i != page_action_views_.end(); ++i) {
if ((*i)->visible()) {
@@ -1149,9 +1124,7 @@ void LocationBarView::RefreshPageActionViews() {
DeletePageActionViews(); // Delete the old views (if any).
page_action_views_.resize(page_actions_.size());
- View* right_anchor = chrome_to_mobile_view_;
- if (!right_anchor)
- right_anchor = star_view_;
+ View* right_anchor = star_view_;
if (!right_anchor)
right_anchor = action_box_button_view_;
DCHECK(right_anchor);
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698