diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-07 02:05:53 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-07 02:05:53 +0000 |
commit | e6ba5a19b804cf3660284cb69720455d9ddbc578 (patch) | |
tree | fbb5a7401230441c8e807a9bc25ebb32f2267f95 /chrome | |
parent | 2a3ea75974b000d88d2b91ac44fa850acab6d364 (diff) | |
download | chromium_src-e6ba5a19b804cf3660284cb69720455d9ddbc578.zip chromium_src-e6ba5a19b804cf3660284cb69720455d9ddbc578.tar.gz chromium_src-e6ba5a19b804cf3660284cb69720455d9ddbc578.tar.bz2 |
Revert 148511 - Add pin icon to the omnibar in windows 8 metro mode.
The pin icon allows pinning and unpinning the start screen. The icon used changes depending on whether the page is currently pinned or not.
BUG=129598
TEST=Test pages can be pinned and unpinned from metro mode
Review URL: https://chromiumcodereview.appspot.com/10800054
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10828193
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150229 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
18 files changed, 24 insertions, 235 deletions
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h index 87242f0..2de3b2b 100644 --- a/chrome/app/chrome_command_ids.h +++ b/chrome/app/chrome_command_ids.h @@ -37,7 +37,7 @@ // Window management commands #define IDC_NEW_WINDOW 34000 #define IDC_NEW_INCOGNITO_WINDOW 34001 -#define IDC_METRO_PIN_TO_START_SCREEN 34005 +#define IDC_PIN_TO_START_SCREEN 34005 #define IDC_CLOSE_WINDOW 34012 #define IDC_ALWAYS_ON_TOP 34013 #define IDC_NEW_TAB 34014 diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index dcd03fd..a6e86f8 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -978,10 +978,10 @@ Psst! Incognito mode <ph name="SHORTCUT_KEY">$1<ex>(Ctrl+Shift+N)</ex></ph> may <message name="IDS_NEW_INCOGNITO_WINDOW" desc="The text label of the New incognito window menu item"> New &incognito window </message> - <message name="IDS_METRO_PIN_TO_START_SCREEN" desc="The text label of the Pin to start screen menu item"> + <message name="IDS_PIN_TO_START_SCREEN" desc="The text label of the Pin to start screen menu item"> Pin to Start screen </message> - <message name="IDS_METRO_UNPIN_FROM_START_SCREEN" desc="The text label of the unpin from start screen menu item"> + <message name="IDS_UNPIN_FROM_START_SCREEN" desc="The text label of the unpin from start screen menu item"> Unpin from Start screen </message> <message name="IDS_EDIT2" desc="The text label before the cut/copy/paste buttons in the merged menu"> @@ -1070,10 +1070,10 @@ Psst! Incognito mode <ph name="SHORTCUT_KEY">$1<ex>(Ctrl+Shift+N)</ex></ph> may <message name="IDS_NEW_INCOGNITO_WINDOW" desc="In Title Case: The text label of the New incognito window menu item"> New &Incognito Window </message> - <message name="IDS_METRO_PIN_TO_START_SCREEN" desc="In Title Case: The text label of the Pin to start screen menu item"> + <message name="IDS_PIN_TO_START_SCREEN" desc="In Title Case: The text label of the Pin to start screen menu item"> Pin to Start Screen </message> - <message name="IDS_METRO_UNPIN_FROM_START_SCREEN" desc="In Title Case: The text label of the Unpin from start screen menu item"> + <message name="IDS_UNPIN_FROM_START_SCREEN" desc="In Title Case: The text label of the Unpin from start screen menu item"> Unpin from Start Screen </message> <message name="IDS_UNDO" desc="In Title Case: The text label of the Undo menu item"> @@ -6480,12 +6480,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_TOOLTIP_HOME" desc="The tooltip for the home button"> Open the home page </message> - <message name="IDS_TOOLTIP_METRO_PIN" desc="The tooltip for the pin button"> - Pin this page to the start menu - </message> - <message name="IDS_TOOLTIP_METRO_PINNED" desc="The tooltip for the pin button when the page is pinned"> - Unpin this page from the start menu - </message> <message name="IDS_TOOLTIP_RELOAD" desc="The tooltip for reload button"> Reload this page </message> @@ -6542,9 +6536,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_ACCNAME_LOCATION" desc="The accessible name for the location bar edit field."> Address </message> - <message name="IDS_ACCNAME_METRO_PIN" desc="The accessible name for the pin button."> - Pin - </message> <message name="IDS_ACCNAME_STAR" desc="The accessible name for the bookmark button."> Bookmark </message> diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 6933830..b30e1b0 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -512,10 +512,6 @@ <structure type="chrome_scaled_image" name="IDR_PANEL_RESTORE" file="panel_restore.png" /> <structure type="chrome_scaled_image" name="IDR_PANEL_RESTORE_C" file="panel_restore_click.png" /> <structure type="chrome_scaled_image" name="IDR_PANEL_RESTORE_H" file="panel_restore_hover.png" /> - <if expr="is_win"> - <structure type="chrome_scaled_image" name="IDR_METRO_PIN" file="metro_pin.png" /> - <structure type="chrome_scaled_image" name="IDR_METRO_PINNED" file="metro_pinned.png" /> - </if> <structure type="chrome_scaled_image" name="IDR_PLUGIN" file="plugin.png" /> <structure type="chrome_scaled_image" name="IDR_PRERENDER" file="prerender_succeed_icon.png" /> <structure type="chrome_scaled_image" name="IDR_PRERENDER_FAIL_ICON" file="prerender_fail_icon.png" /> diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index 4afba06..8ef341e 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -354,7 +354,7 @@ void BrowserCommandController::ExecuteCommandWithDisposition( case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(browser_); break; - case IDC_METRO_PIN_TO_START_SCREEN: + case IDC_PIN_TO_START_SCREEN: TogglePagePinnedToStartScreen(browser_); break; case IDC_BOOKMARK_ALL_TABS: @@ -936,7 +936,7 @@ void BrowserCommandController::UpdateCommandsForBookmarkEditing() { CanBookmarkCurrentPage(browser_)); command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, CanBookmarkAllTabs(browser_)); - command_updater_.UpdateCommandEnabled(IDC_METRO_PIN_TO_START_SCREEN, + command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, true); } diff --git a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm index 81ae699..78b69de 100644 --- a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm +++ b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm @@ -73,8 +73,7 @@ class ViewIDTest : public InProcessBrowserTest { i == VIEW_ID_CONTENTS_SPLIT || i == VIEW_ID_FEEDBACK_BUTTON || i == VIEW_ID_OMNIBOX || - i == VIEW_ID_CHROME_TO_MOBILE_BUTTON || - i == VIEW_ID_METRO_PIN) { + i == VIEW_ID_CHROME_TO_MOBILE_BUTTON) { continue; } diff --git a/chrome/browser/ui/gtk/view_id_util_browsertest.cc b/chrome/browser/ui/gtk/view_id_util_browsertest.cc index a7c4635..6db0866 100644 --- a/chrome/browser/ui/gtk/view_id_util_browsertest.cc +++ b/chrome/browser/ui/gtk/view_id_util_browsertest.cc @@ -44,8 +44,7 @@ IN_PROC_BROWSER_TEST_F(ViewIDTest, Basic) { i == VIEW_ID_BOOKMARK_BAR_ELEMENT || i == VIEW_ID_TAB || i == VIEW_ID_FEEDBACK_BUTTON || - i == VIEW_ID_OMNIBOX || - i == VIEW_ID_METRO_PIN) { + i == VIEW_ID_OMNIBOX) { continue; } diff --git a/chrome/browser/ui/metro_pin_tab_helper.cc b/chrome/browser/ui/metro_pin_tab_helper.cc index a46137a..0a16543 100644 --- a/chrome/browser/ui/metro_pin_tab_helper.cc +++ b/chrome/browser/ui/metro_pin_tab_helper.cc @@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/ui/metro_pinned_state_observer.h" #include "content/public/browser/web_contents.h" #if defined(OS_WIN) @@ -15,8 +14,7 @@ MetroPinTabHelper::MetroPinTabHelper(content::WebContents* web_contents) : content::WebContentsObserver(web_contents), - is_pinned_(false), - observer_(NULL) {} + is_pinned_(false) {} MetroPinTabHelper::~MetroPinTabHelper() {} @@ -42,7 +40,8 @@ void MetroPinTabHelper::TogglePinnedToStartScreen() { // TODO(benwells): This will update the state incorrectly if the user // cancels. To fix this some sort of callback needs to be introduced as // the pinning happens on another thread. - SetIsPinned(!is_pinned_); + is_pinned_ = !is_pinned_; + return; } #endif } @@ -67,16 +66,9 @@ void MetroPinTabHelper::UpdatePinnedStateForCurrentURL() { } GURL url = web_contents()->GetURL(); - SetIsPinned(metro_is_pinned_to_start_screen(UTF8ToUTF16(url.spec())) != 0); + is_pinned_ = metro_is_pinned_to_start_screen(UTF8ToUTF16(url.spec())) != 0; VLOG(1) << __FUNCTION__ << " with url " << UTF8ToUTF16(url.spec()) << " result: " << is_pinned_; } #endif } - -void MetroPinTabHelper::SetIsPinned(bool is_pinned) { - bool was_pinned = is_pinned_; - is_pinned_ = is_pinned; - if (observer_ && is_pinned_ != was_pinned) - observer_->MetroPinnedStateChanged(web_contents(), is_pinned_); -} diff --git a/chrome/browser/ui/metro_pin_tab_helper.h b/chrome/browser/ui/metro_pin_tab_helper.h index f4732d2..c72e503 100644 --- a/chrome/browser/ui/metro_pin_tab_helper.h +++ b/chrome/browser/ui/metro_pin_tab_helper.h @@ -7,20 +7,14 @@ #include "content/public/browser/web_contents_observer.h" -class MetroPinnedStateObserver; - // Per-tab class to help manage metro pinning. class MetroPinTabHelper : public content::WebContentsObserver { public: - explicit MetroPinTabHelper(content::WebContents* web_contents); + explicit MetroPinTabHelper(content::WebContents* tab_contents); virtual ~MetroPinTabHelper(); bool is_pinned() const { return is_pinned_; } - void set_observer(MetroPinnedStateObserver* observer) { - observer_ = observer; - } - void TogglePinnedToStartScreen(); // content::WebContentsObserver overrides: @@ -32,15 +26,9 @@ class MetroPinTabHelper : public content::WebContentsObserver { // Queries the metro driver about the pinned state of the current URL. void UpdatePinnedStateForCurrentURL(); - // Update the pinned state and notify the delegate. - void SetIsPinned(bool is_pinned); - // Whether the current URL is pinned to the metro start screen. bool is_pinned_; - // The observer that we inform when the |is_pinned_| state changes. - MetroPinnedStateObserver* observer_; - DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); }; diff --git a/chrome/browser/ui/metro_pinned_state_observer.h b/chrome/browser/ui/metro_pinned_state_observer.h deleted file mode 100644 index 83f74b0..0000000 --- a/chrome/browser/ui/metro_pinned_state_observer.h +++ /dev/null @@ -1,24 +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_METRO_PINNED_STATE_OBSERVER_H_ -#define CHROME_BROWSER_UI_METRO_PINNED_STATE_OBSERVER_H_ - -namespace content { -class WebContents; -} - -// Objects implement this interface to get notified about changes in the -// metro pinned state. -class MetroPinnedStateObserver { - public: - // Notification that the pinned state of the current URL changed. - virtual void MetroPinnedStateChanged(content::WebContents* source, - bool is_pinned) = 0; - - protected: - virtual ~MetroPinnedStateObserver() {} -}; - -#endif // CHROME_BROWSER_UI_METRO_PINNED_STATE_OBSERVER_H_ diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index 6f5e608d7..2605521 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -242,7 +242,7 @@ bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const { command_id == IDC_VIEW_BACKGROUND_PAGES || command_id == IDC_UPGRADE_DIALOG || command_id == IDC_SHOW_SYNC_SETUP || - command_id == IDC_METRO_PIN_TO_START_SCREEN; + command_id == IDC_PIN_TO_START_SCREEN; } string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const { @@ -284,11 +284,11 @@ string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const { return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL, l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); } - case IDC_METRO_PIN_TO_START_SCREEN: { - int string_id = IDS_METRO_PIN_TO_START_SCREEN; + case IDC_PIN_TO_START_SCREEN: { + int string_id = IDS_PIN_TO_START_SCREEN; TabContents* tab_contents = chrome::GetActiveTabContents(browser_); if (tab_contents && tab_contents->metro_pin_tab_helper()->is_pinned()) { - string_id = IDS_METRO_UNPIN_FROM_START_SCREEN; + string_id = IDS_UNPIN_FROM_START_SCREEN; } return l10n_util::GetStringUTF16(string_id); } @@ -384,11 +384,11 @@ bool WrenchMenuModel::IsCommandIdVisible(int command_id) const { return false; loaded_modules->AcknowledgeConflictNotification(); return true; - } else if (command_id == IDC_METRO_PIN_TO_START_SCREEN) { + } else if (command_id == IDC_PIN_TO_START_SCREEN) { return base::win::IsMetroProcess(); #else if (command_id == IDC_VIEW_INCOMPATIBILITIES || - command_id == IDC_METRO_PIN_TO_START_SCREEN) { + command_id == IDC_PIN_TO_START_SCREEN) { return false; #endif } else if (command_id == IDC_UPGRADE_DIALOG) { @@ -461,8 +461,7 @@ void WrenchMenuModel::Build() { AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); #endif - AddItemWithStringId(IDC_METRO_PIN_TO_START_SCREEN, - IDS_METRO_PIN_TO_START_SCREEN); + AddItemWithStringId(IDC_PIN_TO_START_SCREEN, IDS_PIN_TO_START_SCREEN); bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, bookmark_sub_menu_model_.get()); diff --git a/chrome/browser/ui/view_ids.h b/chrome/browser/ui/view_ids.h index 5a10429..0639d31 100644 --- a/chrome/browser/ui/view_ids.h +++ b/chrome/browser/ui/view_ids.h @@ -46,7 +46,6 @@ enum ViewID { VIEW_ID_FEEDBACK_BUTTON, VIEW_ID_OMNIBOX, VIEW_ID_CHROME_TO_MOBILE_BUTTON, - VIEW_ID_METRO_PIN, // The Bookmark Bar. VIEW_ID_BOOKMARK_BAR, diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 31f3d67..4f79089 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -39,7 +39,6 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window_state.h" -#include "chrome/browser/ui/metro_pin_tab_helper.h" #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" @@ -943,8 +942,6 @@ void BrowserView::UpdateReloadStopState(bool is_loading, bool force) { void BrowserView::UpdateToolbar(TabContents* contents, bool should_restore_state) { toolbar_->Update(contents->web_contents(), should_restore_state); - GetLocationBarView()->SetMetroPinnedState( - contents->metro_pin_tab_helper()->is_pinned()); } void BrowserView::FocusToolbar() { @@ -1415,14 +1412,7 @@ ToolbarView* BrowserView::GetToolbarView() const { /////////////////////////////////////////////////////////////////////////////// // BrowserView, TabStripModelObserver implementation: -void BrowserView::TabInsertedAt(TabContents* contents, - int index, - bool foreground) { - contents->metro_pin_tab_helper()->set_observer(this); -} - void BrowserView::TabDetachedAt(TabContents* contents, int index) { - contents->metro_pin_tab_helper()->set_observer(NULL); // We use index here rather than comparing |contents| because by this time // the model has already removed |contents| from its list, so // browser_->GetActiveWebContents() will return NULL or something else. @@ -1459,8 +1449,6 @@ void BrowserView::TabReplacedAt(TabStripModel* tab_strip_model, TabContents* old_contents, TabContents* new_contents, int index) { - new_contents->metro_pin_tab_helper()->set_observer(this); - if (index != browser_->tab_strip_model()->active_index()) return; @@ -1884,12 +1872,6 @@ void BrowserView::OnSysColorChange() { browser::MaybeShowInvertBubbleView(browser_.get(), contents_); } -void BrowserView::MetroPinnedStateChanged(content::WebContents* contents, - bool is_pinned) { - if (contents == chrome::GetActiveWebContents(browser())) - GetLocationBarView()->SetMetroPinnedState(is_pinned); -} - int BrowserView::GetOTRIconResourceID() const { int otr_resource_id = IDR_OTR_ICON; if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index c1e2a5b..cec02c3 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -16,7 +16,6 @@ #include "chrome/browser/infobars/infobar_container.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/metro_pinned_state_observer.h" #include "chrome/browser/ui/search/search_types.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/views/frame/browser_frame.h" @@ -94,8 +93,7 @@ class BrowserView : public BrowserWindow, public views::ClientView, public InfoBarContainer::Delegate, public views::SingleSplitViewListener, - public gfx::SysColorChangeListener, - public MetroPinnedStateObserver { + public gfx::SysColorChangeListener { public: // The browser view's class name. static const char kViewClassName[]; @@ -355,9 +353,6 @@ class BrowserView : public BrowserWindow, virtual ToolbarView* GetToolbarView() const OVERRIDE; // Overridden from TabStripModelObserver: - virtual void TabInsertedAt(TabContents* contents, - int index, - bool foreground) OVERRIDE; virtual void TabDetachedAt(TabContents* contents, int index) OVERRIDE; virtual void TabDeactivated(TabContents* contents) OVERRIDE; virtual void ActiveTabChanged(TabContents* old_contents, @@ -419,10 +414,6 @@ class BrowserView : public BrowserWindow, // gfx::ScopedSysColorChangeListener overrides: virtual void OnSysColorChange() OVERRIDE; - // MetroPinnedStateObserver overrides: - virtual void MetroPinnedStateChanged(content::WebContents* contents, - bool is_pinned) OVERRIDE; - // Returns the resource ID to use for the OTR icon, which depends on // which layout is being shown and whether we are full-screen. int GetOTRIconResourceID() const; 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 21b2dfd..f945ec6 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -42,7 +42,6 @@ #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" #include "chrome/browser/ui/views/location_bar/location_icon_view.h" -#include "chrome/browser/ui/views/location_bar/metro_pin_view.h" #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" @@ -77,10 +76,6 @@ #include "ui/views/controls/label.h" #include "ui/views/widget/widget.h" -#if defined(OS_WIN) -#include "base/win/metro.h" -#endif - #if defined(OS_WIN) && !defined(USE_AURA) #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" #endif @@ -188,7 +183,6 @@ LocationBarView::LocationBarView(Profile* profile, star_view_(NULL), action_box_button_view_(NULL), chrome_to_mobile_view_(NULL), - metro_pin_view_(NULL), mode_(mode), show_focus_rect_(false), template_url_service_(NULL), @@ -237,6 +231,7 @@ void LocationBarView::Init(views::View* popup_parent_view) { location_icon_view_ = new LocationIconView(this); AddChildView(location_icon_view_); + location_icon_view_->SetVisible(true); location_icon_view_->set_drag_controller(this); ev_bubble_view_ = @@ -287,15 +282,7 @@ void LocationBarView::Init(views::View* popup_parent_view) { // hidden in popups and in the app launcher. star_view_ = new StarView(command_updater_); AddChildView(star_view_); - - // Add the metro pin view, if this is windows and we are running in Metro - // mode. -#if defined(OS_WIN) - if (base::win::IsMetroProcess()) { - metro_pin_view_ = new MetroPinView(command_updater_); - AddChildView(metro_pin_view_); - } -#endif + star_view_->SetVisible(true); // Also 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. @@ -515,11 +502,6 @@ void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { chrome::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); } -void LocationBarView::SetMetroPinnedState(bool is_pinned) { - if (metro_pin_view_) - metro_pin_view_->SetIsPinned(is_pinned); -} - void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { zoom_view_->SetZoomIconTooltipPercent(zoom_percent); } @@ -674,9 +656,6 @@ void LocationBarView::Layout() { if (star_view_ && star_view_->visible()) entry_width -= star_view_->GetPreferredSize().width() + GetItemPadding(); - if (metro_pin_view_ && metro_pin_view_->visible()) - entry_width -= metro_pin_view_->GetPreferredSize().width() + - GetItemPadding(); if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible()) { entry_width -= chrome_to_mobile_view_->GetPreferredSize().width() + GetItemPadding(); @@ -765,14 +744,6 @@ void LocationBarView::Layout() { offset -= GetItemPadding() - star_view_->GetBuiltInHorizontalPadding(); } - if (metro_pin_view_ && metro_pin_view_->visible()) { - offset += metro_pin_view_->GetBuiltInHorizontalPadding(); - int pin_width = metro_pin_view_->GetPreferredSize().width(); - offset -= pin_width; - metro_pin_view_->SetBounds(offset, location_y, pin_width, location_height); - offset -= GetItemPadding() - metro_pin_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(); @@ -1158,8 +1129,6 @@ void LocationBarView::RefreshPageActionViews() { page_action_views_.resize(page_actions_.size()); View* right_anchor = chrome_to_mobile_view_; if (!right_anchor) - right_anchor = metro_pin_view_; - if (!right_anchor) right_anchor = star_view_; if (!right_anchor) right_anchor = action_box_button_view_; 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 fade943..d045e53 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -42,7 +42,6 @@ class GURL; class InstantController; class KeywordHintView; class LocationIconView; -class MetroPinView; class PageActionWithBadgeView; class PageActionImageView; class Profile; @@ -210,9 +209,6 @@ class LocationBarView : public LocationBar, // Shows the bookmark bubble. void ShowStarBubble(const GURL& url, bool newly_bookmarked); - // Toggles the metro pin on or off. - void SetMetroPinnedState(bool is_pinned); - // Shows the Chrome To Mobile bubble. void ShowChromeToMobileBubble(); @@ -530,9 +526,6 @@ class LocationBarView : public LocationBar, // The Chrome To Mobile page action icon view. ChromeToMobileView* chrome_to_mobile_view_; - // The button to pin the page to the Metro start screen. - MetroPinView* metro_pin_view_; - // The mode that dictates how the bar shows. Mode mode_; diff --git a/chrome/browser/ui/views/location_bar/metro_pin_view.cc b/chrome/browser/ui/views/location_bar/metro_pin_view.cc deleted file mode 100644 index 7450c81..0000000 --- a/chrome/browser/ui/views/location_bar/metro_pin_view.cc +++ /dev/null @@ -1,43 +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/metro_pin_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 "grit/generated_resources.h" -#include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" - -MetroPinView::MetroPinView(CommandUpdater* command_updater) - : ALLOW_THIS_IN_INITIALIZER_LIST(ImageButton(this)), - command_updater_(command_updater) { - set_id(VIEW_ID_METRO_PIN); - SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE); - SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_METRO_PIN)); - TouchableLocationBarView::Init(this); - SetIsPinned(false); -} - -MetroPinView::~MetroPinView() {} - -void MetroPinView::SetIsPinned(bool is_pinned) { - SetTooltipText(l10n_util::GetStringUTF16( - is_pinned ? IDS_TOOLTIP_METRO_PINNED : IDS_TOOLTIP_METRO_PIN)); - SetImage(BS_NORMAL, ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - is_pinned ? IDR_METRO_PINNED : IDR_METRO_PIN)); -} - -void MetroPinView::ButtonPressed(Button* sender, const views::Event& event) { - command_updater_->ExecuteCommand(IDC_METRO_PIN_TO_START_SCREEN); -} - -int MetroPinView::GetBuiltInHorizontalPadding() const { - return GetBuiltInHorizontalPaddingImpl(); -} diff --git a/chrome/browser/ui/views/location_bar/metro_pin_view.h b/chrome/browser/ui/views/location_bar/metro_pin_view.h deleted file mode 100644 index d888de2..0000000 --- a/chrome/browser/ui/views/location_bar/metro_pin_view.h +++ /dev/null @@ -1,39 +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_METRO_PIN_VIEW_H_ -#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_METRO_PIN_VIEW_H_ - -#include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" -#include "ui/views/controls/button/image_button.h" - -class CommandUpdater; - -class MetroPinView - : public views::ImageButton, - public views::ButtonListener, - public TouchableLocationBarView { - public: - explicit MetroPinView(CommandUpdater* command_updater); - virtual ~MetroPinView(); - - // When the page is already pinned, clicking the pin view will cause the page - // to become unpinned. - void SetIsPinned(bool is_pinned); - - // views::ButtonListener. - virtual void ButtonPressed(Button* sender, - const views::Event& event) OVERRIDE; - - // TouchableLocationBarView. - virtual int GetBuiltInHorizontalPadding() const OVERRIDE; - - private: - // The CommandUpdater for the Browser object that owns the location bar. - CommandUpdater* command_updater_; - - DISALLOW_IMPLICIT_CONSTRUCTORS(MetroPinView); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_METRO_PIN_VIEW_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 9e90ca7..7b0dc7e 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3303,7 +3303,6 @@ 'browser/ui/login/login_prompt.h', 'browser/ui/media_stream_infobar_delegate.h', 'browser/ui/media_stream_infobar_delegate.cc', - 'browser/ui/metro_pinned_state_observer.h', 'browser/ui/metro_pin_tab_helper.cc', 'browser/ui/metro_pin_tab_helper.h', 'browser/ui/network_profile_bubble.cc', @@ -3764,8 +3763,6 @@ 'browser/ui/views/location_bar/location_bar_view.h', 'browser/ui/views/location_bar/location_icon_view.cc', 'browser/ui/views/location_bar/location_icon_view.h', - 'browser/ui/views/location_bar/metro_pin_view.cc', - 'browser/ui/views/location_bar/metro_pin_view.h', 'browser/ui/views/location_bar/page_action_image_view.cc', 'browser/ui/views/location_bar/page_action_image_view.h', 'browser/ui/views/location_bar/page_action_with_badge_view.cc', |