summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-30 13:03:20 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-30 13:03:20 +0000
commite9bfbddc52bd27ef33716bf888a98d8dd9378eb8 (patch)
tree1342cbf20c776d7f3d67f91edc3a10496b0e1398 /chrome/browser
parenta2c8cba08f74470d1d3573dcaae1c62323455c4d (diff)
downloadchromium_src-e9bfbddc52bd27ef33716bf888a98d8dd9378eb8.zip
chromium_src-e9bfbddc52bd27ef33716bf888a98d8dd9378eb8.tar.gz
chromium_src-e9bfbddc52bd27ef33716bf888a98d8dd9378eb8.tar.bz2
Integrate Chrome To Mobile with Action Box UI.
Gate IsChromeToMobileEnabled on Action Box flag. Nix commandline flags, and about:flags entry. Nix IDS_FLAGS_[EN|DIS]ABLE_CHROME_TO_MOBILE_[NAME|DESCRIPTION]. Remove page action icons, anchor to action box button: Nix chrome_to_mobile_decoration.[h|mm] and use. Nix chrome_to_mobile_view.[h|cc] and use. Nix LocationBarViewGtk::CreateChromeToMobileButton, etc. Nix Command observation from LocationBarView[Mac|Gtk|<win>]. Nix chromeToMobileBubblePoint, GetChromeToMobileBubblePoint, etc. Nix SetChromeToMobileDecorationLit, VIEW_ID_CHROME_TO_MOBILE_BUTTON, etc. Add SetActionBoxIcon, call from bubble show/close. Revise SetTextButtonIconToId for TextButton anchor view. Disable ShowChromeToMobileBubble on GTK :( TODO(followup): Refine updating/observation of IDC_CHROME_TO_MOBILE_PAGE. TODO(followup): TBD GTK Action Box, fallback UI, or more cleanup. BUG=102709,120905,125307 TEST=Chrome To Mobile is enabled iff Action Box is enabled; disabled on GTK. Review URL: https://chromiumcodereview.appspot.com/10885024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/about_flags.cc7
-rw-r--r--chrome/browser/chrome_to_mobile_service.cc15
-rw-r--r--chrome/browser/chrome_to_mobile_service.h3
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.h8
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm22
-rw-r--r--chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm49
-rw-r--r--chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.h44
-rw-r--r--chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.mm56
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h21
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm42
-rw-r--r--chrome/browser/ui/cocoa/toolbar/toolbar_controller.h4
-rw-r--r--chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/view_id_util_browsertest.mm3
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.cc63
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.h19
-rw-r--r--chrome/browser/ui/gtk/view_id_util.cc3
-rw-r--r--chrome/browser/ui/view_ids.h1
-rw-r--r--chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc15
-rw-r--r--chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc83
-rw-r--r--chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h52
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc45
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.h4
22 files changed, 69 insertions, 494 deletions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 3a70d41..b57e03e 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -685,13 +685,6 @@ const Experiment kExperiments[] = {
kOsAll,
SINGLE_VALUE_TYPE(switches::kEnableDiscoveryInNewTabPage)
},
- {
- "disable-chrome-to-mobile", // FLAGS:RECORD_UMA
- IDS_FLAGS_DISABLE_CHROME_TO_MOBILE_NAME,
- IDS_FLAGS_DISABLE_CHROME_TO_MOBILE_DESCRIPTION,
- kOsAll,
- SINGLE_VALUE_TYPE(switches::kDisableChromeToMobile)
- },
#if defined(GOOGLE_CHROME_BUILD)
{
"disable-asynchronous-spellchecking",
diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc
index 4e81202..b8cd66b 100644
--- a/chrome/browser/chrome_to_mobile_service.cc
+++ b/chrome/browser/chrome_to_mobile_service.cc
@@ -48,9 +48,6 @@
namespace {
-// The default enabled/disabled state of the Chrome To Mobile feature.
-const bool kChromeToMobileEnabled = true;
-
// The maximum number of retries for the URLFetcher requests.
const size_t kMaxRetries = 1;
@@ -165,15 +162,9 @@ ChromeToMobileService::JobData::~JobData() {}
// static
bool ChromeToMobileService::IsChromeToMobileEnabled() {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
-
- if (command_line->HasSwitch(switches::kDisableChromeToMobile))
- return false;
-
- if (command_line->HasSwitch(switches::kEnableChromeToMobile))
- return true;
-
- return kChromeToMobileEnabled;
+ // Chrome To Mobile is currently gated on the Action Box UI.
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableActionBox);
}
// static
diff --git a/chrome/browser/chrome_to_mobile_service.h b/chrome/browser/chrome_to_mobile_service.h
index cd1e2d5..162180d 100644
--- a/chrome/browser/chrome_to_mobile_service.h
+++ b/chrome/browser/chrome_to_mobile_service.h
@@ -97,8 +97,7 @@ class ChromeToMobileService : public ProfileKeyedService,
JobType type;
};
- // Returns whether Chrome To Mobile is enabled. Check for the 'disable' or
- // 'enable' command line switches, otherwise relay the default enabled state.
+ // Returns whether Chrome To Mobile is enabled (gated on the Action Box UI).
static bool IsChromeToMobileEnabled();
// Register the user prefs associated with this service.
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.h b/chrome/browser/ui/cocoa/browser_window_controller.h
index 2d72077..b843c26 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller.h
@@ -296,6 +296,10 @@ class WebContents;
// Show the Chrome To Mobile bubble (e.g. user just clicked on the icon)
- (void)showChromeToMobileBubble;
+// Nil out the weak Chrome To Mobile bubble controller reference.
+// This should be called by the ChromeToMobileBubbleController on close.
+- (void)chromeToMobileBubbleWindowWillClose;
+
// Returns the (lazily created) window sheet controller of this window. Used
// for the per-tab sheets.
- (GTMWindowSheetController*)sheetController;
@@ -327,10 +331,6 @@ class WebContents;
// coordinates.
- (NSPoint)bookmarkBubblePoint;
-// Return the Chrome To Mobile bubble window's arrow anchor point, in window
-// coordinates.
-- (NSPoint)chromeToMobileBubblePoint;
-
// Shows or hides the Instant preview contents.
- (void)showInstant:(content::WebContents*)previewContents;
- (void)hideInstant;
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index c650777..a5dbbcd 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1648,10 +1648,6 @@ enum {
bookmarkBubbleController_ = nil;
}
-- (NSPoint)chromeToMobileBubblePoint {
- return [toolbarController_ chromeToMobileBubblePoint];
-}
-
// Show the Chrome To Mobile bubble (e.g. user just clicked on the icon).
- (void)showChromeToMobileBubble {
// Do nothing if the bubble is already showing.
@@ -1663,27 +1659,11 @@ enum {
initWithParentWindow:[self window]
browser:browser_.get()];
[chromeToMobileBubbleController_ showWindow:self];
-
- NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
- [center addObserver:self
- selector:@selector(chromeToMobileBubbleWindowWillClose:)
- name:NSWindowWillCloseNotification
- object:[chromeToMobileBubbleController_ window]];
- // Show the lit Chrome To Mobile icon while the bubble is visible.
- [self locationBarBridge]->SetChromeToMobileDecorationLit(true);
}
// Nil out the weak Chrome To Mobile bubble controller reference.
-- (void)chromeToMobileBubbleWindowWillClose:(NSNotification*)notification {
- DCHECK_EQ([notification object], [chromeToMobileBubbleController_ window]);
-
- NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
- [center removeObserver:self
- name:NSWindowWillCloseNotification
- object:[chromeToMobileBubbleController_ window]];
+- (void)chromeToMobileBubbleWindowWillClose {
chromeToMobileBubbleController_ = nil;
- // Restore the dimmed Chrome To Mobile icon when the bubble closes.
- [self locationBarBridge]->SetChromeToMobileDecorationLit(false);
}
// Handle the editBookmarkNode: action sent from bookmark bubble controllers.
diff --git a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm
index ae823a9..e9d2db3 100644
--- a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm
@@ -15,6 +15,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "grit/generated_resources.h"
+#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/text/bytes_formatting.h"
@@ -88,6 +89,15 @@ void ChromeToMobileBubbleNotificationBridge::OnSendComplete(bool success) {
// Instruct the service to delete the snapshot file.
service_->DeleteSnapshot(snapshotPath_);
+ BrowserWindowController* controller = [BrowserWindowController
+ browserWindowControllerForWindow:self.parentWindow];
+ [controller chromeToMobileBubbleWindowWillClose];
+
+ // Restore the Action Box icon when the bubble closes.
+ LocationBarViewMac* locationBar = [controller locationBarBridge];
+ if (locationBar)
+ locationBar->SetActionBoxIcon(IDR_ACTION_BOX_BUTTON);
+
// We caught a close so we don't need to observe further notifications.
bridge_.reset(NULL);
[progressAnimation_ stopAnimation];
@@ -141,29 +151,24 @@ void ChromeToMobileBubbleNotificationBridge::OnSendComplete(bool success) {
[window setFrame:windowFrame display:YES animate:NO];
}
- // Get the anchor point for the bubble in screen coordinates.
- BrowserWindowController* controller = [BrowserWindowController
- browserWindowControllerForWindow:self.parentWindow];
- if (controller != nil) {
- LocationBarViewMac* locationBar = [controller locationBarBridge];
- NSPoint bubblePoint;
- if (extensions::switch_utils::IsExtensionsInActionBoxEnabled()) {
- bubblePoint = locationBar->GetActionBoxAnchorPoint();
- bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint];
- // Without an arrow, the anchor point of a bubble is the top left corner,
- // but GetActionBoxAnchorPoint returns the top right corner.
- bubblePoint.x -= self.bubble.frame.size.width;
- [self.bubble setArrowLocation:info_bubble::kNoArrow];
- [self.bubble setCornerFlags:info_bubble::kRoundedBottomCorners];
- [self.bubble setAlignment:info_bubble::kAlignEdgeToAnchorEdge];
- [window setContentSize:self.bubble.frame.size];
- [window setContentView:self.bubble];
- } else {
- bubblePoint = locationBar->GetChromeToMobileBubblePoint();
- bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint];
- [self.bubble setArrowLocation:info_bubble::kTopRight];
- }
+ LocationBarViewMac* locationBar = [[BrowserWindowController
+ browserWindowControllerForWindow:self.parentWindow] locationBarBridge];
+ if (locationBar) {
+ // Get the anchor point for the bubble in screen coordinates.
+ NSPoint bubblePoint = locationBar->GetActionBoxAnchorPoint();
+ bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint];
+ // Without an arrow, the anchor point of a bubble is the top left corner,
+ // but GetActionBoxAnchorPoint returns the top right corner.
+ bubblePoint.x -= self.bubble.frame.size.width;
+ [self.bubble setArrowLocation:info_bubble::kNoArrow];
+ [self.bubble setCornerFlags:info_bubble::kRoundedBottomCorners];
+ [self.bubble setAlignment:info_bubble::kAlignEdgeToAnchorEdge];
+ [window setContentSize:self.bubble.frame.size];
+ [window setContentView:self.bubble];
[self setAnchorPoint:bubblePoint];
+
+ // Show the lit Chrome To Mobile icon while the bubble is open.
+ locationBar->SetActionBoxIcon(IDR_MOBILE_LIT);
}
// Initialize the checkbox to send an offline copy.
diff --git a/chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.h b/chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.h
deleted file mode 100644
index ca79c7f..0000000
--- a/chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_CHROME_TO_MOBILE_DECORATION_H_
-#define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_CHROME_TO_MOBILE_DECORATION_H_
-
-#import <Cocoa/Cocoa.h>
-
-#include "chrome/browser/ui/cocoa/location_bar/image_decoration.h"
-
-class CommandUpdater;
-class Profile;
-
-// Chrome To Mobile icon on the right side of the field.
-class ChromeToMobileDecoration : public ImageDecoration {
- public:
- ChromeToMobileDecoration(Profile* profile, CommandUpdater* command_updater);
- virtual ~ChromeToMobileDecoration();
-
- // Get the point where the bubble should point within the decoration's frame.
- NSPoint GetBubblePointInFrame(NSRect frame);
-
- // Update the icon to reflect the lit or unlit state.
- void SetLit(bool lit);
-
- // Implement |LocationBarDecoration|.
- virtual bool AcceptsMousePress() OVERRIDE;
- virtual bool OnMousePressed(NSRect frame) OVERRIDE;
- virtual NSString* GetToolTip() OVERRIDE;
-
- private:
- Profile* profile_;
-
- // Used for showing the Chrome To Mobile bubble.
- CommandUpdater* command_updater_; // Weak, owned by Browser.
-
- // The string to show for a tooltip.
- scoped_nsobject<NSString> tooltip_;
-
- DISALLOW_COPY_AND_ASSIGN(ChromeToMobileDecoration);
-};
-
-#endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_CHROME_TO_MOBILE_DECORATION_H_
diff --git a/chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.mm b/chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.mm
deleted file mode 100644
index 14c287b..0000000
--- a/chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.mm
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.h"
-
-#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/command_updater.h"
-#include "chrome/browser/themes/theme_service.h"
-#include "chrome/browser/themes/theme_service_factory.h"
-#import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util_mac.h"
-
-// An inset to anchor the bubble within the icon's built-in padding.
-// The popup should be where the Omnibox popup ends up (2px below field).
-// Matches the bookmark bubble and star settings.
-const CGFloat kIconYInset = 2.0;
-
-ChromeToMobileDecoration::ChromeToMobileDecoration(
- Profile* profile,
- CommandUpdater* command_updater)
- : profile_(profile),
- command_updater_(command_updater) {
- SetVisible(false);
- SetLit(false);
- tooltip_.reset([l10n_util::GetNSStringWithFixup(
- IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP) retain]);
-}
-
-ChromeToMobileDecoration::~ChromeToMobileDecoration() {
-}
-
-NSPoint ChromeToMobileDecoration::GetBubblePointInFrame(NSRect frame) {
- const NSRect draw_frame = GetDrawRectInFrame(frame);
- return NSMakePoint(NSMidX(draw_frame), NSMaxY(draw_frame) - kIconYInset);
-}
-
-void ChromeToMobileDecoration::SetLit(bool lit) {
- ThemeService* service = ThemeServiceFactory::GetForProfile(profile_);
- SetImage(service->GetNSImageNamed(lit ? IDR_MOBILE_LIT : IDR_MOBILE, true));
-}
-
-bool ChromeToMobileDecoration::AcceptsMousePress() {
- return true;
-}
-
-bool ChromeToMobileDecoration::OnMousePressed(NSRect frame) {
- command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE);
- return true;
-}
-
-NSString* ChromeToMobileDecoration::GetToolTip() {
- return tooltip_.get();
-}
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
index 986bcaa..2485cf3 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
@@ -14,7 +14,6 @@
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/api/prefs/pref_member.h"
-#include "chrome/browser/command_observer.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
@@ -24,7 +23,6 @@
#include "chrome/common/content_settings_types.h"
@class AutocompleteTextField;
-class ChromeToMobileDecoration;
class CommandUpdater;
class ContentSettingDecoration;
class EVBubbleDecoration;
@@ -46,8 +44,7 @@ class ZoomDecoration;
class LocationBarViewMac : public LocationBar,
public LocationBarTesting,
public OmniboxEditController,
- public content::NotificationObserver,
- public CommandObserver {
+ public content::NotificationObserver {
public:
LocationBarViewMac(AutocompleteTextField* field,
CommandUpdater* command_updater,
@@ -90,8 +87,8 @@ class LocationBarViewMac : public LocationBar,
// Set the starred state of the bookmark star.
void SetStarred(bool starred);
- // Set ChromeToMobileDecoration's lit state (to update the icon).
- void SetChromeToMobileDecorationLit(bool lit);
+ // Set the icon image resource for the action box plus decoration.
+ void SetActionBoxIcon(int image_id);
// Happens when the zoom changes for the active tab. |can_show_bubble| is
// false when the change in zoom for the active tab wasn't an explicit user
@@ -108,10 +105,6 @@ class LocationBarViewMac : public LocationBar,
// anchoring its bubbles.
NSPoint GetActionBoxAnchorPoint() const;
- // Get the point in window coordinates on the Chrome To Mobile icon for
- // anchoring its bubble.
- NSPoint GetChromeToMobileBubblePoint() const;
-
// Get the point in window coordinates in the security icon at which the page
// info bubble aims.
NSPoint GetPageInfoBubblePoint() const;
@@ -183,9 +176,6 @@ class LocationBarViewMac : public LocationBar,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // CommandObserver:
- virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE;
-
private:
// Posts |notification| to the default notification center.
void PostNotification(NSString* notification);
@@ -209,7 +199,7 @@ class LocationBarViewMac : public LocationBar,
// Checks if the bookmark star should be enabled or not.
bool IsStarEnabled();
- // Update the Chrome To Mobile page action visibility and command state.
+ // Update the Chrome To Mobile page action command state.
void UpdateChromeToMobileEnabled();
// Updates the zoom decoration in the omnibox with the current zoom level.
@@ -248,9 +238,6 @@ class LocationBarViewMac : public LocationBar,
// Bookmark star right of page actions.
scoped_ptr<StarDecoration> star_decoration_;
- // Chrome To Mobile page action icon.
- scoped_ptr<ChromeToMobileDecoration> chrome_to_mobile_decoration_;
-
// A zoom icon at the end of the omnibox, which shows at non-standard zoom
// levels.
scoped_ptr<ZoomDecoration> zoom_decoration_;
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index c050524..d3d221f 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -37,7 +37,6 @@
#import "chrome/browser/ui/cocoa/first_run_bubble_controller.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
-#import "chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.h"
#import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h"
#import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h"
#import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h"
@@ -102,7 +101,6 @@ LocationBarViewMac::LocationBarViewMac(
OmniboxViewMac::GetFieldFont())),
plus_decoration_(NULL),
star_decoration_(new StarDecoration(command_updater)),
- chrome_to_mobile_decoration_(NULL),
zoom_decoration_(new ZoomDecoration(toolbar_model)),
keyword_hint_decoration_(
new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())),
@@ -113,16 +111,6 @@ LocationBarViewMac::LocationBarViewMac(
content::PAGE_TRANSITION_TYPED |
content::PAGE_TRANSITION_FROM_ADDRESS_BAR)),
weak_ptr_factory_(this) {
- // 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()) {
- command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this);
- chrome_to_mobile_decoration_.reset(
- new ChromeToMobileDecoration(profile, command_updater));
- UpdateChromeToMobileEnabled();
- }
-
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableActionBox)) {
plus_decoration_.reset(new PlusDecoration(this, command_updater, browser_));
}
@@ -502,8 +490,8 @@ void LocationBarViewMac::SetStarred(bool starred) {
OnDecorationsChanged();
}
-void LocationBarViewMac::SetChromeToMobileDecorationLit(bool lit) {
- chrome_to_mobile_decoration_->SetLit(lit);
+void LocationBarViewMac::SetActionBoxIcon(int image_id) {
+ plus_decoration_->SetImage(OmniboxViewMac::ImageForResource(image_id));
OnDecorationsChanged();
}
@@ -528,16 +516,6 @@ NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const {
return [field_ convertPoint:point toView:nil];
}
-NSPoint LocationBarViewMac::GetChromeToMobileBubblePoint() const {
- AutocompleteTextFieldCell* cell = [field_ cell];
- const NSRect frame =
- [cell frameForDecoration:chrome_to_mobile_decoration_.get()
- inFrame:[field_ bounds]];
- const NSPoint point =
- chrome_to_mobile_decoration_->GetBubblePointInFrame(frame);
- return [field_ convertPoint:point toView:nil];
-}
-
NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const {
AutocompleteTextFieldCell* cell = [field_ cell];
if (ev_bubble_decoration_->IsVisible()) {
@@ -600,12 +578,6 @@ void LocationBarViewMac::Observe(int type,
}
}
-void LocationBarViewMac::EnabledStateChangedForCommand(int id, bool enabled) {
- DCHECK_EQ(id, IDC_CHROME_TO_MOBILE_PAGE);
- UpdateChromeToMobileEnabled();
- OnChanged();
-}
-
void LocationBarViewMac::PostNotification(NSString* notification) {
[[NSNotificationCenter defaultCenter] postNotificationName:notification
object:[NSValue valueWithPointer:this]];
@@ -683,8 +655,6 @@ void LocationBarViewMac::Layout() {
[cell addRightDecoration:plus_decoration_.get()];
[cell addRightDecoration:star_decoration_.get()];
[cell addRightDecoration:zoom_decoration_.get()];
- if (chrome_to_mobile_decoration_.get())
- [cell addRightDecoration:chrome_to_mobile_decoration_.get()];
// Note that display order is right to left.
for (size_t i = 0; i < page_action_decorations_.size(); ++i) {
@@ -755,13 +725,9 @@ bool LocationBarViewMac::IsStarEnabled() {
}
void LocationBarViewMac::UpdateChromeToMobileEnabled() {
- if (!chrome_to_mobile_decoration_.get())
- return;
-
- DCHECK(ChromeToMobileService::IsChromeToMobileEnabled());
- bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() &&
+ bool enabled = ChromeToMobileService::IsChromeToMobileEnabled() &&
+ [field_ isEditable] && !toolbar_model_->input_in_progress() &&
ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles();
- chrome_to_mobile_decoration_->SetVisible(enabled);
command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
}
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.h b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.h
index fb38896..382c52d 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.h
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.h
@@ -146,10 +146,6 @@ class NotificationBridge;
// associated window's coordinate system.
- (NSPoint)bookmarkBubblePoint;
-// Return the anchor point for the Chrome To Mobile bubble on its icon.
-// The returned value is in the associated window's coordinate system.
-- (NSPoint)chromeToMobileBubblePoint;
-
// Returns the desired toolbar height for the given compression factor.
- (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight;
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
index f90c883..6593fce 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
@@ -717,10 +717,6 @@ class NotificationBridge : public content::NotificationObserver {
return locationBarView_->GetBookmarkBubblePoint();
}
-- (NSPoint)chromeToMobileBubblePoint {
- return locationBarView_->GetChromeToMobileBubblePoint();
-}
-
- (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight {
// With no toolbar, just ignore the compression.
return hasToolbar_ ? kBaseToolbarHeight - compressByHeight :
diff --git a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm
index 78b69de..723e7f2 100644
--- a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm
+++ b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm
@@ -72,8 +72,7 @@ class ViewIDTest : public InProcessBrowserTest {
i == VIEW_ID_AUTOCOMPLETE ||
i == VIEW_ID_CONTENTS_SPLIT ||
i == VIEW_ID_FEEDBACK_BUTTON ||
- i == VIEW_ID_OMNIBOX ||
- i == VIEW_ID_CHROME_TO_MOBILE_BUTTON) {
+ i == VIEW_ID_OMNIBOX) {
continue;
}
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index edf23a6..05d3990 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -390,7 +390,6 @@ LocationBarViewGtk::LocationBarViewGtk(Browser* browser)
: zoom_image_(NULL),
star_image_(NULL),
starred_(false),
- chrome_to_mobile_image_(NULL),
site_type_alignment_(NULL),
site_type_event_box_(NULL),
location_icon_image_(NULL),
@@ -426,7 +425,6 @@ LocationBarViewGtk::~LocationBarViewGtk() {
// All of our widgets should be children of / owned by the alignment.
zoom_.Destroy();
star_.Destroy();
- chrome_to_mobile_view_.Destroy();
hbox_.Destroy();
content_setting_hbox_.Destroy();
page_action_hbox_.Destroy();
@@ -560,20 +558,9 @@ void LocationBarViewGtk::Init(bool popup_window_mode) {
gtk_box_pack_end(GTK_BOX(hbox_.get()), alignment,
FALSE, FALSE, 0);
} else if (browser_defaults::bookmarks_enabled && !ShouldOnlyShowLocation()) {
- // Hide the star and Chrome To Mobile icons in popups, app windows, etc.
+ // Hide the star icon in popups, app windows, etc.
CreateStarButton();
gtk_box_pack_end(GTK_BOX(hbox_.get()), star_.get(), FALSE, FALSE, 0);
-
- // 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()) {
- CreateChromeToMobileButton();
- gtk_box_pack_end(GTK_BOX(hbox_.get()), chrome_to_mobile_view_.get(),
- FALSE, FALSE, 0);
- command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this);
- UpdateChromeToMobileIcon();
- }
}
CreateZoomButton();
@@ -735,7 +722,6 @@ GtkWidget* LocationBarViewGtk::GetPageActionWidget(
void LocationBarViewGtk::Update(const WebContents* contents) {
UpdateZoomIcon();
UpdateStarIcon();
- UpdateChromeToMobileIcon();
UpdateSiteTypeArea();
UpdateContentSettingsIcons();
UpdatePageActions();
@@ -858,15 +844,6 @@ void LocationBarViewGtk::CreateStarButton() {
OnStarButtonPressThunk));
}
-void LocationBarViewGtk::CreateChromeToMobileButton() {
- chrome_to_mobile_view_.Own(
- CreateIconButton(&chrome_to_mobile_image_,
- IDR_MOBILE,
- VIEW_ID_CHROME_TO_MOBILE_BUTTON,
- IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP,
- OnChromeToMobileButtonPressThunk));
-}
-
void LocationBarViewGtk::OnInputInProgress(bool in_progress) {
// This is identical to the Windows code, except that we don't proxy the call
// back through the Toolbar, and just access the model here.
@@ -1108,12 +1085,10 @@ void LocationBarViewGtk::Observe(int type,
std::string* pref_name_in = content::Details<std::string>(details).ptr();
DCHECK(pref_name_in);
- if (*pref_name_in == prefs::kEditBookmarksEnabled) {
+ if (*pref_name_in == prefs::kEditBookmarksEnabled)
UpdateStarIcon();
- UpdateChromeToMobileIcon();
- } else {
+ else
NOTREACHED();
- }
break;
}
@@ -1168,7 +1143,6 @@ void LocationBarViewGtk::Observe(int type,
UpdateZoomIcon();
UpdateStarIcon();
- UpdateChromeToMobileIcon();
UpdateSiteTypeArea();
UpdateContentSettingsIcons();
UpdateWebIntentsButton();
@@ -1494,16 +1468,6 @@ gboolean LocationBarViewGtk::OnStarButtonPress(GtkWidget* widget,
return FALSE;
}
-gboolean LocationBarViewGtk::OnChromeToMobileButtonPress(
- GtkWidget* widget,
- GdkEventButton* event) {
- if (event->button == 1) {
- chrome::ExecuteCommand(browser_, IDC_CHROME_TO_MOBILE_PAGE);
- return TRUE;
- }
- return FALSE;
-}
-
void LocationBarViewGtk::ShowZoomBubble() {
if (!zoom_.get() || toolbar_model_->input_in_progress())
return;
@@ -1521,7 +1485,9 @@ void LocationBarViewGtk::ShowStarBubble(const GURL& url,
}
void LocationBarViewGtk::ShowChromeToMobileBubble() {
- ChromeToMobileBubbleGtk::Show(GTK_IMAGE(chrome_to_mobile_image_), browser_);
+ // TODO(msw): Chrome to Mobile is currently disabled on GTK.
+ // ChromeToMobileBubbleGtk::Show(GTK_WIDGET(action_box_button_->widget()),
+ // browser_);
}
void LocationBarViewGtk::SetStarred(bool starred) {
@@ -1580,17 +1546,6 @@ void LocationBarViewGtk::UpdateStarIcon() {
}
}
-void LocationBarViewGtk::UpdateChromeToMobileIcon() {
- if (!chrome_to_mobile_view_.get())
- return;
-
- Profile* profile = browser_->profile();
- bool enabled = !toolbar_model_->input_in_progress() &&
- ChromeToMobileServiceFactory::GetForProfile(profile)->HasMobiles();
- gtk_widget_set_visible(chrome_to_mobile_view_.get(), enabled);
- command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
-}
-
bool LocationBarViewGtk::ShouldOnlyShowLocation() {
return !browser_->is_type_tabbed();
}
@@ -1935,12 +1890,6 @@ void LocationBarViewGtk::PageActionViewGtk::Observe(
DisconnectPageActionAccelerator();
}
-void LocationBarViewGtk::EnabledStateChangedForCommand(int id, bool enabled) {
- DCHECK_EQ(id, IDC_CHROME_TO_MOBILE_PAGE);
- if (enabled != gtk_widget_get_visible(chrome_to_mobile_view_.get()))
- UpdateChromeToMobileIcon();
-}
-
void LocationBarViewGtk::PageActionViewGtk::ConnectPageActionAccelerator() {
const ExtensionSet* extensions = owner_->browser()->profile()->
GetExtensionService()->extensions();
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h
index 5863dd9..24e3b95 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h
@@ -16,7 +16,6 @@
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/api/prefs/pref_member.h"
-#include "chrome/browser/command_observer.h"
#include "chrome/browser/extensions/extension_context_menu_model.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
@@ -61,8 +60,7 @@ class AcceleratorGtk;
class LocationBarViewGtk : public OmniboxEditController,
public LocationBar,
public LocationBarTesting,
- public content::NotificationObserver,
- public CommandObserver {
+ public content::NotificationObserver {
public:
explicit LocationBarViewGtk(Browser* browser);
virtual ~LocationBarViewGtk();
@@ -163,9 +161,6 @@ class LocationBarViewGtk : public OmniboxEditController,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // CommandObserver:
- virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE;
-
// Edit background color.
static const GdkColor kBackgroundColor;
@@ -373,8 +368,6 @@ class LocationBarViewGtk : public OmniboxEditController,
GdkEventButton*);
CHROMEGTK_CALLBACK_1(LocationBarViewGtk, gboolean, OnStarButtonPress,
GdkEventButton*);
- CHROMEGTK_CALLBACK_1(LocationBarViewGtk, gboolean,
- OnChromeToMobileButtonPress, GdkEventButton*);
// Updates the site type area: changes the icon and shows/hides the EV
// certificate information.
@@ -401,7 +394,7 @@ class LocationBarViewGtk : public OmniboxEditController,
// available horizontal space in the location bar.
void AdjustChildrenVisibility();
- // Build the zoom, star, and Chrome To Mobile icons.
+ // Build the zoom, and star icons.
GtkWidget* CreateIconButton(
GtkWidget** image,
int image_id,
@@ -410,7 +403,6 @@ class LocationBarViewGtk : public OmniboxEditController,
gboolean (click_callback)(GtkWidget*, GdkEventButton*, gpointer));
void CreateZoomButton();
void CreateStarButton();
- void CreateChromeToMobileButton();
// Update the zoom icon after zoom changes.
void UpdateZoomIcon();
@@ -418,9 +410,6 @@ class LocationBarViewGtk : public OmniboxEditController,
// Update the star icon after it is toggled or the theme changes.
void UpdateStarIcon();
- // Update the chrome to mobile icon after the theme changes, etc.
- void UpdateChromeToMobileIcon();
-
// Returns true if we should only show the URL and none of the extras like
// the star button or page actions.
bool ShouldOnlyShowLocation();
@@ -437,10 +426,6 @@ class LocationBarViewGtk : public OmniboxEditController,
GtkWidget* star_image_;
bool starred_;
- // The Chrome To Mobile button and image.
- ui::OwnedWidgetGtk chrome_to_mobile_view_;
- GtkWidget* chrome_to_mobile_image_;
-
// An icon to the left of the address bar.
GtkWidget* site_type_alignment_;
GtkWidget* site_type_event_box_;
diff --git a/chrome/browser/ui/gtk/view_id_util.cc b/chrome/browser/ui/gtk/view_id_util.cc
index 4301c61..c9aa121 100644
--- a/chrome/browser/ui/gtk/view_id_util.cc
+++ b/chrome/browser/ui/gtk/view_id_util.cc
@@ -80,9 +80,6 @@ const char* GetNameFromID(ViewID id) {
case VIEW_ID_STAR_BUTTON:
return "chrome-toolbar-star-button";
- case VIEW_ID_CHROME_TO_MOBILE_BUTTON:
- return "chrome-toolbar-chrome-to-mobile-button";
-
case VIEW_ID_LOCATION_BAR:
return "chrome-location-bar";
diff --git a/chrome/browser/ui/view_ids.h b/chrome/browser/ui/view_ids.h
index 0639d31..784e1ac 100644
--- a/chrome/browser/ui/view_ids.h
+++ b/chrome/browser/ui/view_ids.h
@@ -45,7 +45,6 @@ enum ViewID {
VIEW_ID_BROWSER_ACTION_TOOLBAR,
VIEW_ID_FEEDBACK_BUTTON,
VIEW_ID_OMNIBOX,
- VIEW_ID_CHROME_TO_MOBILE_BUTTON,
// The Bookmark Bar.
VIEW_ID_BOOKMARK_BAR,
diff --git a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc
index 52aebb7..9755133 100644
--- a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc
+++ b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc
@@ -25,7 +25,6 @@
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/radio_button.h"
#include "ui/views/controls/button/text_button.h"
-#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
#include "ui/views/layout/grid_layout.h"
@@ -69,10 +68,10 @@ void CheckboxNativeThemeBorder::GetInsets(gfx::Insets* insets) const {
insets->Set(insets->top(), 0, insets->bottom(), insets->right());
}
-// Downcast the View to an ImageView and set the image with the resource |id|.
-void SetImageViewToId(views::View* image_view, int id) {
- static_cast<views::ImageView*>(image_view)->
- SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id));
+// Downcast TextButton |view| and set the icon image with the resource |id|.
+void SetTextButtonIconToId(views::View* view, int id) {
+ static_cast<views::TextButton*>(view)->
+ SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id));
}
} // namespace
@@ -108,7 +107,7 @@ void ChromeToMobileBubbleView::ShowBubble(views::View* anchor_view,
return;
// Show the lit mobile device icon during the bubble's lifetime.
- SetImageViewToId(anchor_view, IDR_MOBILE_LIT);
+ SetTextButtonIconToId(anchor_view, IDR_MOBILE_LIT);
bubble_ = new ChromeToMobileBubbleView(anchor_view, browser);
views::BubbleDelegateView::CreateBubble(bubble_);
bubble_->Show();
@@ -137,8 +136,8 @@ void ChromeToMobileBubbleView::WindowClosing() {
// Instruct the service to delete the snapshot file.
service_->DeleteSnapshot(snapshot_path_);
- // Restore the resting state mobile device icon.
- SetImageViewToId(anchor_view(), IDR_MOBILE);
+ // Restore the resting state action box icon.
+ SetTextButtonIconToId(anchor_view(), IDR_ACTION_BOX_BUTTON);
}
bool ChromeToMobileBubbleView::AcceleratorPressed(
diff --git a/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc b/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc
deleted file mode 100644
index bc486bf..0000000
--- a/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h"
-
-#include "base/utf_string_conversions.h"
-#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/command_updater.h"
-#include "chrome/browser/ui/view_ids.h"
-#include "chrome/browser/ui/views/browser_dialogs.h"
-#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/accessibility/accessible_view_state.h"
-#include "ui/base/event.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-
-ChromeToMobileView::ChromeToMobileView(
- LocationBarView* location_bar_view,
- CommandUpdater* command_updater)
- : location_bar_view_(location_bar_view),
- command_updater_(command_updater) {
- set_id(VIEW_ID_CHROME_TO_MOBILE_BUTTON);
- set_accessibility_focusable(true);
- SetImage(
- ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_MOBILE));
- SetTooltipText(
- l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP));
- SetVisible(command_updater_->IsCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE));
- command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this);
- TouchableLocationBarView::Init(this);
-}
-
-ChromeToMobileView::~ChromeToMobileView() {
- command_updater_->RemoveCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this);
-}
-
-void ChromeToMobileView::EnabledStateChangedForCommand(int id, bool enabled) {
- DCHECK_EQ(id, IDC_CHROME_TO_MOBILE_PAGE);
- if (enabled != visible()) {
- SetVisible(enabled);
- location_bar_view_->Update(NULL);
- }
-}
-
-int ChromeToMobileView::GetBuiltInHorizontalPadding() const {
- return GetBuiltInHorizontalPaddingImpl();
-}
-
-void ChromeToMobileView::GetAccessibleState(ui::AccessibleViewState* state) {
- state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_CHROME_TO_MOBILE);
- state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
-}
-
-bool ChromeToMobileView::GetTooltipText(const gfx::Point& p,
- string16* tooltip) const {
- // Don't show tooltip to distract user if ChromeToMobileBubbleView is showing.
- if (chrome::IsChromeToMobileBubbleViewShowing())
- return false;
-
- return views::ImageView::GetTooltipText(p, tooltip);
-}
-
-bool ChromeToMobileView::OnMousePressed(const ui::MouseEvent& event) {
- // Show the bubble on mouse release; that is standard button behavior.
- return true;
-}
-
-void ChromeToMobileView::OnMouseReleased(const ui::MouseEvent& event) {
- if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location()))
- command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE);
-}
-
-bool ChromeToMobileView::OnKeyPressed(const ui::KeyEvent& event) {
- if (event.key_code() == ui::VKEY_SPACE ||
- event.key_code() == ui::VKEY_RETURN) {
- command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE);
- return true;
- }
- return false;
-}
diff --git a/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h b/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h
deleted file mode 100644
index 2b4f89c..0000000
--- a/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CHROME_TO_MOBILE_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CHROME_TO_MOBILE_VIEW_H_
-
-#include "chrome/browser/command_observer.h"
-#include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h"
-#include "ui/views/controls/image_view.h"
-
-class CommandUpdater;
-class LocationBarView;
-
-namespace views {
-class MouseEvent;
-}
-
-// A Page Action image view for the Chrome To Mobile bubble.
-class ChromeToMobileView : public views::ImageView,
- public CommandObserver,
- public TouchableLocationBarView {
- public:
- ChromeToMobileView(LocationBarView* location_bar_view,
- CommandUpdater* command_updater);
- virtual ~ChromeToMobileView();
-
- // CommandObserver overrides:
- virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE;
-
- // TouchableLocationBarView.
- virtual int GetBuiltInHorizontalPadding() const OVERRIDE;
-
- private:
- // views::ImageView overrides:
- virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
- virtual bool GetTooltipText(const gfx::Point& p,
- string16* tooltip) const OVERRIDE;
- virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
- virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
- virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
-
- // The LocationBarView hosting this view.
- LocationBarView* location_bar_view_;
-
- // The CommandUpdater for the Browser object that owns the location bar.
- CommandUpdater* command_updater_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeToMobileView);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CHROME_TO_MOBILE_VIEW_H_
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 9e4d4da..cfc819a 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"
@@ -198,7 +197,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),
@@ -291,21 +289,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_);
@@ -425,7 +413,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);
@@ -551,8 +540,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 {
@@ -688,10 +677,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();
@@ -710,8 +695,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.
@@ -774,16 +759,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()) {
@@ -1156,9 +1131,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);
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index 2d41122..8e0ced5 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -31,7 +31,6 @@
#endif
class ActionBoxButtonView;
-class ChromeToMobileView;
class CommandUpdater;
class ContentSettingBubbleModelDelegate;
class ContentSettingImageView;
@@ -529,9 +528,6 @@ class LocationBarView : public LocationBar,
// The action box button (plus).
ActionBoxButtonView* action_box_button_view_;
- // The Chrome To Mobile page action icon view.
- ChromeToMobileView* chrome_to_mobile_view_;
-
// The mode that dictates how the bar shows.
Mode mode_;