summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-03 01:15:43 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-03 01:15:43 +0000
commit8e8bbde463441b8ebc514a85b4e604ec907f8b99 (patch)
tree3fa1c1bcd7bf5b53246ba25cc9348fd07e9f36d0 /chrome
parent933a46df63d4c544e3d589f553b698f031f52249 (diff)
downloadchromium_src-8e8bbde463441b8ebc514a85b4e604ec907f8b99.zip
chromium_src-8e8bbde463441b8ebc514a85b4e604ec907f8b99.tar.gz
chromium_src-8e8bbde463441b8ebc514a85b4e604ec907f8b99.tar.bz2
Star/reload shuffle, Windows version.
BUG=27570 TEST=Star should be moved to right hand end of location bar, reload to left endcap. Review URL: http://codereview.chromium.org/1561009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43562 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/theme/reload.pngbin1345 -> 1246 bytes
-rw-r--r--chrome/app/theme/reload_d.pngbin1204 -> 1108 bytes
-rw-r--r--chrome/app/theme/reload_endcap.pngbin1274 -> 0 bytes
-rw-r--r--chrome/app/theme/reload_endcap_h.pngbin1604 -> 0 bytes
-rw-r--r--chrome/app/theme/reload_endcap_p.pngbin1584 -> 0 bytes
-rw-r--r--chrome/app/theme/reload_h.pngbin1668 -> 1549 bytes
-rw-r--r--chrome/app/theme/reload_p.pngbin1530 -> 1439 bytes
-rw-r--r--chrome/app/theme/star.pngbin1276 -> 862 bytes
-rw-r--r--chrome/app/theme/star_d.pngbin1142 -> 0 bytes
-rw-r--r--chrome/app/theme/star_h.pngbin1617 -> 0 bytes
-rw-r--r--chrome/app/theme/star_mask.pngbin207 -> 0 bytes
-rw-r--r--chrome/app/theme/star_noborder.pngbin830 -> 0 bytes
-rw-r--r--chrome/app/theme/star_noborder_center.pngbin862 -> 0 bytes
-rw-r--r--chrome/app/theme/star_p.pngbin1568 -> 0 bytes
-rw-r--r--chrome/app/theme/starred.pngbin1283 -> 1027 bytes
-rw-r--r--chrome/app/theme/starred_h.pngbin1619 -> 0 bytes
-rw-r--r--chrome/app/theme/starred_noborder.pngbin980 -> 0 bytes
-rw-r--r--chrome/app/theme/starred_noborder_center.pngbin1027 -> 0 bytes
-rw-r--r--chrome/app/theme/starred_p.pngbin1595 -> 0 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd14
-rw-r--r--chrome/browser/browser_theme_pack.cc82
-rw-r--r--chrome/browser/browser_theme_provider.cc29
-rw-r--r--chrome/browser/chromeos/compact_location_bar_host.cc5
-rw-r--r--chrome/browser/chromeos/compact_location_bar_host.h4
-rw-r--r--chrome/browser/chromeos/compact_location_bar_view.cc77
-rw-r--r--chrome/browser/chromeos/compact_location_bar_view.h19
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc14
-rw-r--r--chrome/browser/chromeos/frame/browser_view.h2
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.mm4
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc3
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc3
-rw-r--r--chrome/browser/views/frame/browser_view.cc32
-rw-r--r--chrome/browser/views/location_bar_view.cc108
-rw-r--r--chrome/browser/views/location_bar_view.h35
-rw-r--r--chrome/browser/views/toolbar_star_toggle.cc133
-rw-r--r--chrome/browser/views/toolbar_star_toggle.h85
-rw-r--r--chrome/browser/views/toolbar_view.cc161
-rw-r--r--chrome/browser/views/toolbar_view.h17
-rwxr-xr-xchrome/chrome_browser.gypi4
-rw-r--r--chrome/test/data/profiles/complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/Cached Theme.pakbin1238893 -> 1220575 bytes
40 files changed, 211 insertions, 620 deletions
diff --git a/chrome/app/theme/reload.png b/chrome/app/theme/reload.png
index c033579..99550be 100644
--- a/chrome/app/theme/reload.png
+++ b/chrome/app/theme/reload.png
Binary files differ
diff --git a/chrome/app/theme/reload_d.png b/chrome/app/theme/reload_d.png
index ec5811a..37a4d1d 100644
--- a/chrome/app/theme/reload_d.png
+++ b/chrome/app/theme/reload_d.png
Binary files differ
diff --git a/chrome/app/theme/reload_endcap.png b/chrome/app/theme/reload_endcap.png
deleted file mode 100644
index 4f534c5..0000000
--- a/chrome/app/theme/reload_endcap.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/reload_endcap_h.png b/chrome/app/theme/reload_endcap_h.png
deleted file mode 100644
index b657995..0000000
--- a/chrome/app/theme/reload_endcap_h.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/reload_endcap_p.png b/chrome/app/theme/reload_endcap_p.png
deleted file mode 100644
index a32c9cc..0000000
--- a/chrome/app/theme/reload_endcap_p.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/reload_h.png b/chrome/app/theme/reload_h.png
index 196727d..7ee1024 100644
--- a/chrome/app/theme/reload_h.png
+++ b/chrome/app/theme/reload_h.png
Binary files differ
diff --git a/chrome/app/theme/reload_p.png b/chrome/app/theme/reload_p.png
index a4d6ddd..47aee77 100644
--- a/chrome/app/theme/reload_p.png
+++ b/chrome/app/theme/reload_p.png
Binary files differ
diff --git a/chrome/app/theme/star.png b/chrome/app/theme/star.png
index 987aa04..87bef3f 100644
--- a/chrome/app/theme/star.png
+++ b/chrome/app/theme/star.png
Binary files differ
diff --git a/chrome/app/theme/star_d.png b/chrome/app/theme/star_d.png
deleted file mode 100644
index cf23eda..0000000
--- a/chrome/app/theme/star_d.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/star_h.png b/chrome/app/theme/star_h.png
deleted file mode 100644
index f6a40ef6..0000000
--- a/chrome/app/theme/star_h.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/star_mask.png b/chrome/app/theme/star_mask.png
deleted file mode 100644
index a04c2c6..0000000
--- a/chrome/app/theme/star_mask.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/star_noborder.png b/chrome/app/theme/star_noborder.png
deleted file mode 100644
index ac73d2c..0000000
--- a/chrome/app/theme/star_noborder.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/star_noborder_center.png b/chrome/app/theme/star_noborder_center.png
deleted file mode 100644
index 87bef3f..0000000
--- a/chrome/app/theme/star_noborder_center.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/star_p.png b/chrome/app/theme/star_p.png
deleted file mode 100644
index 4d0027b..0000000
--- a/chrome/app/theme/star_p.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/starred.png b/chrome/app/theme/starred.png
index bf0ba85..5113f95 100644
--- a/chrome/app/theme/starred.png
+++ b/chrome/app/theme/starred.png
Binary files differ
diff --git a/chrome/app/theme/starred_h.png b/chrome/app/theme/starred_h.png
deleted file mode 100644
index aa0016a..0000000
--- a/chrome/app/theme/starred_h.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/starred_noborder.png b/chrome/app/theme/starred_noborder.png
deleted file mode 100644
index 93b5463..0000000
--- a/chrome/app/theme/starred_noborder.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/starred_noborder_center.png b/chrome/app/theme/starred_noborder_center.png
deleted file mode 100644
index 5113f95..0000000
--- a/chrome/app/theme/starred_noborder_center.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/starred_p.png b/chrome/app/theme/starred_p.png
deleted file mode 100644
index 91a7c8e..0000000
--- a/chrome/app/theme/starred_p.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index e6cecb7..09f40f5 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -48,20 +48,8 @@
<include name="IDR_RELOAD_NOBORDER_CENTER" file="reload_noborder_center.png" type="BINDATA" />
<include name="IDR_RELOAD_H" file="reload_h.png" type="BINDATA" />
<include name="IDR_RELOAD_P" file="reload_p.png" type="BINDATA" />
- <include name="IDR_RELOAD_ENDCAP" file="reload_endcap.png" type="BINDATA" />
- <include name="IDR_RELOAD_ENDCAP_H" file="reload_endcap_h.png" type="BINDATA" />
- <include name="IDR_RELOAD_ENDCAP_P" file="reload_endcap_p.png" type="BINDATA" />
<include name="IDR_STAR" file="star.png" type="BINDATA" />
- <include name="IDR_STAR_NOBORDER" file="star_noborder.png" type="BINDATA" />
- <include name="IDR_STAR_NOBORDER_CENTER" file="star_noborder_center.png" type="BINDATA" />
- <include name="IDR_STAR_D" file="star_d.png" type="BINDATA" />
- <include name="IDR_STAR_H" file="star_h.png" type="BINDATA" />
- <include name="IDR_STAR_P" file="star_p.png" type="BINDATA" />
<include name="IDR_STARRED" file="starred.png" type="BINDATA" />
- <include name="IDR_STARRED_NOBORDER" file="starred_noborder.png" type="BINDATA" />
- <include name="IDR_STARRED_NOBORDER_CENTER" file="starred_noborder_center.png" type="BINDATA" />
- <include name="IDR_STARRED_H" file="starred_h.png" type="BINDATA" />
- <include name="IDR_STARRED_P" file="starred_p.png" type="BINDATA" />
<include name="IDR_TAB_ACTIVE_CENTER" file="tab_active_center.png" type="BINDATA" />
<include name="IDR_TAB_ACTIVE_LEFT" file="tab_active_left.png" type="BINDATA" />
<include name="IDR_TAB_ACTIVE_RIGHT" file="tab_active_right.png" type="BINDATA" />
@@ -315,7 +303,7 @@
<include name="IDR_FORWARD_MASK" file="forward_mask.png" type="BINDATA" />
<include name="IDR_BACK_MASK" file="back_mask.png" type="BINDATA" />
<include name="IDR_BUTTON_MASK" file="button_mask.png" type="BINDATA" />
- <include name="IDR_STAR_MASK" file="star_mask.png" type="BINDATA" />
+ <include name="IDR_RELOAD_MASK" file="reload_mask.png" type="BINDATA" />
<include name="IDR_GO_MASK" file="go_mask.png" type="BINDATA" />
<include name="IDR_NEWTAB_BUTTON_MASK" file="newtab_button_mask.png" type="BINDATA" />
diff --git a/chrome/browser/browser_theme_pack.cc b/chrome/browser/browser_theme_pack.cc
index d61daab..450639d 100644
--- a/chrome/browser/browser_theme_pack.cc
+++ b/chrome/browser/browser_theme_pack.cc
@@ -4,37 +4,26 @@
#include "chrome/browser/browser_theme_pack.h"
-#include <algorithm>
-#include <climits>
-#include <set>
-#include <vector>
-
#include "app/resource_bundle.h"
#include "base/data_pack.h"
-#include "base/logging.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "base/values.h"
#include "chrome/browser/browser_theme_provider.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/theme_resources_util.h"
-#include "chrome/common/extensions/extension.h"
#include "gfx/codec/png_codec.h"
#include "gfx/skbitmap_operations.h"
#include "grit/app_resources.h"
#include "grit/theme_resources.h"
#include "net/base/file_stream.h"
#include "net/base/net_errors.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkUnPreMultiply.h"
namespace {
// Version number of the current theme pack. We just throw out and rebuild
// theme packs that aren't int-equal to this.
-const int kThemePackVersion = 5;
+const int kThemePackVersion = 6;
// IDs that are in the DataPack won't clash with the positive integer
// int32_t. kHeaderID should always have the maximum value because we want the
@@ -131,48 +120,33 @@ PersistingImagesTable kPersistingImages[] = {
{ 21, IDR_FORWARD_H, NULL },
{ 22, IDR_FORWARD_P, NULL },
{ 23, IDR_RELOAD, NULL },
- { 24, IDR_RELOAD_H, NULL },
- { 25, IDR_RELOAD_P, NULL },
- { 26, IDR_HOME, NULL },
- { 27, IDR_HOME_H, NULL },
- { 28, IDR_HOME_P, NULL },
- { 29, IDR_STAR, NULL },
- { 30, IDR_STAR_NOBORDER, NULL },
- { 31, IDR_STAR_NOBORDER_CENTER, NULL },
- { 32, IDR_STAR_D, NULL },
- { 33, IDR_STAR_H, NULL },
- { 34, IDR_STAR_P, NULL },
- { 35, IDR_STARRED, NULL },
- { 36, IDR_STARRED_NOBORDER, NULL },
- { 37, IDR_STARRED_NOBORDER_CENTER, NULL },
- { 38, IDR_STARRED_H, NULL },
- { 39, IDR_STARRED_P, NULL },
- { 40, IDR_GO, NULL },
- { 41, IDR_GO_NOBORDER, NULL },
- { 42, IDR_GO_NOBORDER_CENTER, NULL },
- { 43, IDR_GO_H, NULL },
- { 44, IDR_GO_P, NULL },
- { 45, IDR_STOP, NULL },
- { 46, IDR_STOP_NOBORDER, NULL },
- { 47, IDR_STOP_NOBORDER_CENTER, NULL },
- { 48, IDR_STOP_H, NULL },
- { 49, IDR_STOP_P, NULL },
- { 50, IDR_MENU_BOOKMARK, NULL },
- { 51, IDR_MENU_PAGE, NULL },
- { 52, IDR_MENU_PAGE_RTL, NULL },
- { 53, IDR_MENU_CHROME, NULL },
- { 54, IDR_MENU_CHROME_RTL, NULL },
- { 55, IDR_MENU_DROPARROW, NULL },
- { 56, IDR_THROBBER, NULL },
- { 57, IDR_THROBBER_WAITING, NULL },
- { 58, IDR_THROBBER_LIGHT, NULL },
- { 59, IDR_LOCATIONBG, NULL },
-
- { 60, IDR_RELOAD_NOBORDER, NULL },
- { 61, IDR_RELOAD_NOBORDER_CENTER, NULL },
- { 62, IDR_RELOAD_ENDCAP, NULL },
- { 63, IDR_RELOAD_ENDCAP_H, NULL },
- { 64, IDR_RELOAD_ENDCAP_P, NULL }
+ { 24, IDR_RELOAD_NOBORDER, NULL },
+ { 25, IDR_RELOAD_NOBORDER_CENTER, NULL },
+ { 26, IDR_RELOAD_H, NULL },
+ { 27, IDR_RELOAD_P, NULL },
+ { 28, IDR_HOME, NULL },
+ { 29, IDR_HOME_H, NULL },
+ { 30, IDR_HOME_P, NULL },
+ { 31, IDR_GO, NULL },
+ { 32, IDR_GO_NOBORDER, NULL },
+ { 33, IDR_GO_NOBORDER_CENTER, NULL },
+ { 34, IDR_GO_H, NULL },
+ { 35, IDR_GO_P, NULL },
+ { 36, IDR_STOP, NULL },
+ { 37, IDR_STOP_NOBORDER, NULL },
+ { 38, IDR_STOP_NOBORDER_CENTER, NULL },
+ { 39, IDR_STOP_H, NULL },
+ { 40, IDR_STOP_P, NULL },
+ { 41, IDR_MENU_BOOKMARK, NULL },
+ { 42, IDR_MENU_PAGE, NULL },
+ { 43, IDR_MENU_PAGE_RTL, NULL },
+ { 44, IDR_MENU_CHROME, NULL },
+ { 45, IDR_MENU_CHROME_RTL, NULL },
+ { 46, IDR_MENU_DROPARROW, NULL },
+ { 47, IDR_THROBBER, NULL },
+ { 48, IDR_THROBBER_WAITING, NULL },
+ { 49, IDR_THROBBER_LIGHT, NULL },
+ { 50, IDR_LOCATIONBG, NULL }
};
int GetPersistentIDByName(const std::string& key) {
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc
index dab544e..f586aa0 100644
--- a/chrome/browser/browser_theme_provider.cc
+++ b/chrome/browser/browser_theme_provider.cc
@@ -1,40 +1,21 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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/browser_theme_provider.h"
#include "app/resource_bundle.h"
-#include "base/file_util.h"
-#include "base/stl_util-inl.h"
-#include "base/string_util.h"
-#include "base/thread.h"
-#include "base/values.h"
-#include "chrome/browser/browser_list.h"
-#include "chrome/browser/browser_process.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_theme_pack.h"
-#include "chrome/browser/browser_window.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/metrics/user_metrics.h"
-#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/theme_resources_util.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/notification_source.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "gfx/codec/png_codec.h"
-#include "gfx/skbitmap_operations.h"
#include "grit/app_resources.h"
#include "grit/theme_resources.h"
-#include "net/base/file_stream.h"
-#include "net/base/net_errors.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkUnPreMultiply.h"
#if defined(OS_WIN)
#include "app/win_util.h"
@@ -162,12 +143,8 @@ const int kToolbarButtonIDs[] = {
IDR_BACK, IDR_BACK_D, IDR_BACK_H, IDR_BACK_P,
IDR_FORWARD, IDR_FORWARD_D, IDR_FORWARD_H, IDR_FORWARD_P,
IDR_RELOAD, IDR_RELOAD_NOBORDER, IDR_RELOAD_NOBORDER_CENTER, IDR_RELOAD_H,
- IDR_RELOAD_P, IDR_RELOAD_ENDCAP, IDR_RELOAD_ENDCAP_H, IDR_RELOAD_ENDCAP_P,
+ IDR_RELOAD_P,
IDR_HOME, IDR_HOME_H, IDR_HOME_P,
- IDR_STAR, IDR_STAR_NOBORDER, IDR_STAR_NOBORDER_CENTER, IDR_STAR_D, IDR_STAR_H,
- IDR_STAR_P,
- IDR_STARRED, IDR_STARRED_NOBORDER, IDR_STARRED_NOBORDER_CENTER, IDR_STARRED_H,
- IDR_STARRED_P,
IDR_GO, IDR_GO_NOBORDER, IDR_GO_NOBORDER_CENTER, IDR_GO_H, IDR_GO_P,
IDR_STOP, IDR_STOP_NOBORDER, IDR_STOP_NOBORDER_CENTER, IDR_STOP_H, IDR_STOP_P,
IDR_MENU_BOOKMARK,
diff --git a/chrome/browser/chromeos/compact_location_bar_host.cc b/chrome/browser/chromeos/compact_location_bar_host.cc
index a412cb6..eaba6ef 100644
--- a/chrome/browser/chromeos/compact_location_bar_host.cc
+++ b/chrome/browser/chromeos/compact_location_bar_host.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/tabs/tab.h"
#include "chrome/browser/views/tabs/tab_strip.h"
-#include "chrome/browser/views/toolbar_star_toggle.h"
#include "views/controls/scrollbar/native_scroll_bar.h"
#include "views/focus/external_focus_tracker.h"
#include "views/focus/view_storage.h"
@@ -268,10 +267,6 @@ void CompactLocationBarHost::SetEnabled(bool enabled) {
}
}
-ToolbarStarToggle* CompactLocationBarHost::GetStarButton() {
- return GetClbView()->star_button();
-}
-
void CompactLocationBarHost::Show(bool a) {
MessageLoopForUI::current()->AddObserver(mouse_observer_.get());
DropdownBarHost::Show(a);
diff --git a/chrome/browser/chromeos/compact_location_bar_host.h b/chrome/browser/chromeos/compact_location_bar_host.h
index e6816fc..7ec6a25 100644
--- a/chrome/browser/chromeos/compact_location_bar_host.h
+++ b/chrome/browser/chromeos/compact_location_bar_host.h
@@ -16,7 +16,6 @@
class BrowserView;
class TabContents;
class Tab;
-class ToolbarStarToggle;
namespace chromeos {
@@ -61,9 +60,6 @@ class CompactLocationBarHost : public DropdownBarHost,
// Enable/disable the compact location bar.
void SetEnabled(bool enabled);
- // Returns the star button for compact location bar.
- ToolbarStarToggle* GetStarButton();
-
// Overridden from DropdownBarhost.
virtual void Show(bool animate);
virtual void Hide(bool animate);
diff --git a/chrome/browser/chromeos/compact_location_bar_view.cc b/chrome/browser/chromeos/compact_location_bar_view.cc
index af803e4..31f2c0f 100644
--- a/chrome/browser/chromeos/compact_location_bar_view.cc
+++ b/chrome/browser/chromeos/compact_location_bar_view.cc
@@ -8,10 +8,8 @@
#include <algorithm>
#include "app/l10n_util.h"
-#include "app/drag_drop_types.h"
#include "app/resource_bundle.h"
#include "chrome/app/chrome_dll_resource.h"
-#include "chrome/browser/bookmarks/bookmark_drag_data.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
#include "chrome/browser/browser_list.h"
@@ -24,7 +22,6 @@
#include "chrome/browser/views/browser_actions_container.h"
#include "chrome/browser/views/event_utils.h"
#include "chrome/browser/views/frame/browser_view.h"
-#include "chrome/browser/views/toolbar_star_toggle.h"
#include "gfx/canvas.h"
#include "gfx/point.h"
#include "grit/chromium_strings.h"
@@ -33,7 +30,6 @@
#include "views/background.h"
#include "views/controls/button/image_button.h"
#include "views/controls/native/native_view_host.h"
-#include "views/drag_utils.h"
#include "views/widget/widget.h"
#include "views/window/window.h"
@@ -51,8 +47,7 @@ const int kWidgetsSeparatorWidth = 2;
CompactLocationBarView::CompactLocationBarView(CompactLocationBarHost* host)
: DropdownBarView(host),
reload_(NULL),
- browser_actions_(NULL),
- star_(NULL) {
+ browser_actions_(NULL) {
SetFocusable(true);
}
@@ -101,7 +96,7 @@ void CompactLocationBarView::Init() {
reload_->SetImage(views::CustomButton::BS_PUSHED,
tp->GetBitmapNamed(IDR_RELOAD_P));
reload_->SetBackground(color, background,
- tp->GetBitmapNamed(IDR_BUTTON_MASK));
+ tp->GetBitmapNamed(IDR_RELOAD_MASK));
AddChildView(reload_);
@@ -120,14 +115,6 @@ void CompactLocationBarView::Init() {
location_entry_view_->set_focus_view(this);
location_entry_view_->Attach(location_entry_->GetNativeView());
- star_ = new ToolbarStarToggle(this);
- star_->SetDragController(this);
- star_->set_profile(browser()->profile());
- star_->set_host_view(this);
- star_->set_bubble_positioner(this);
- star_->Init();
- AddChildView(star_);
-
location_entry_->Update(browser()->GetSelectedTabContents());
// Note: we tell the BrowserActionsContainer not to save its size because
@@ -145,15 +132,12 @@ gfx::Size CompactLocationBarView::GetPreferredSize() {
return gfx::Size(); // Not initialized yet, do nothing.
gfx::Size reload_size = reload_->GetPreferredSize();
- gfx::Size star_size = star_->GetPreferredSize();
gfx::Size location_size = location_entry_view_->GetPreferredSize();
gfx::Size ba_size = browser_actions_->GetPreferredSize();
- int width =
- reload_size.width() + kEntryLeftMargin + star_size.width() +
+ int width = kCompactLocationLeftMargin + reload_size.width() +
std::max(kDefaultLocationEntryWidth,
location_entry_view_->GetPreferredSize().width()) +
ba_size.width() +
- kCompactLocationLeftMargin +
kCompactLocationRightMargin;
return gfx::Size(width, kDefaultLocationBarHeight);
}
@@ -168,12 +152,7 @@ void CompactLocationBarView::Layout() {
int reload_y = (height() - reload_size.height()) / 2;
reload_->SetBounds(cur_x, reload_y,
reload_size.width(), reload_size.height());
- cur_x += reload_size.width() + kEntryLeftMargin;
-
- gfx::Size star_size = star_->GetPreferredSize();
- int star_y = (height() - star_size.height()) / 2;
- star_->SetBounds(cur_x, star_y, star_size.width(), star_size.height());
- cur_x += star_size.width();
+ cur_x += reload_size.width();
gfx::Size ba_size = browser_actions_->GetPreferredSize();
int ba_y = (height() - ba_size.height()) / 2;
@@ -277,52 +256,4 @@ gfx::Rect CompactLocationBarView::GetLocationStackBounds() const {
return popup.AdjustToFit(GetWidget()->GetWindow()->GetBounds());
}
-////////////////////////////////////////////////////////////////////////////////
-// views::DragController overrides:
-void CompactLocationBarView::WriteDragData(views::View* sender,
- const gfx::Point& press_pt,
- OSExchangeData* data) {
- DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE);
-
- UserMetrics::RecordAction(UserMetricsAction("CompactLocationBar_DragStar"),
- browser()->profile());
-
- // If there is a bookmark for the URL, add the bookmark drag data for it. We
- // do this to ensure the bookmark is moved, rather than creating an new
- // bookmark.
- TabContents* tab = browser()->GetSelectedTabContents();
- if (tab) {
- Profile* profile = browser()->profile();
- if (profile && profile->GetBookmarkModel()) {
- const BookmarkNode* node = profile->GetBookmarkModel()->
- GetMostRecentlyAddedNodeForURL(tab->GetURL());
- if (node) {
- BookmarkDragData bookmark_data(node);
- bookmark_data.Write(profile, data);
- }
- }
-
- drag_utils::SetURLAndDragImage(tab->GetURL(),
- UTF16ToWideHack(tab->GetTitle()),
- tab->GetFavIcon(),
- data);
- }
-}
-
-int CompactLocationBarView::GetDragOperations(views::View* sender,
- const gfx::Point& p) {
- DCHECK(sender == star_);
- TabContents* tab = browser()->GetSelectedTabContents();
- if (!tab || !tab->ShouldDisplayURL() || !tab->GetURL().is_valid()) {
- return DragDropTypes::DRAG_NONE;
- }
- Profile* profile = browser()->profile();
- if (profile && profile->GetBookmarkModel() &&
- profile->GetBookmarkModel()->IsBookmarked(tab->GetURL())) {
- return DragDropTypes::DRAG_MOVE | DragDropTypes::DRAG_COPY |
- DragDropTypes::DRAG_LINK;
- }
- return DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK;
-}
-
} // namespace chromeos
diff --git a/chrome/browser/chromeos/compact_location_bar_view.h b/chrome/browser/chromeos/compact_location_bar_view.h
index e4f8d73..8ffe0de 100644
--- a/chrome/browser/chromeos/compact_location_bar_view.h
+++ b/chrome/browser/chromeos/compact_location_bar_view.h
@@ -17,11 +17,9 @@ class AutocompleteEditViewGtk;
class Browser;
class BrowserActionsContainer;
class BrowserView;
-class ToolbarStarToggleGtk;
class Tab;
class TabContents;
class TabStrip;
-class ToolbarStarToggle;
namespace views {
class ImageButton;
@@ -36,8 +34,7 @@ namespace chromeos {
class CompactLocationBarView : public DropdownBarView,
public views::ButtonListener,
public AutocompleteEditController,
- public BubblePositioner,
- public views::DragController {
+ public BubblePositioner {
public:
explicit CompactLocationBarView(CompactLocationBarHost* host);
~CompactLocationBarView();
@@ -47,8 +44,6 @@ class CompactLocationBarView : public DropdownBarView,
void Update(const TabContents* contents);
- ToolbarStarToggle* star_button() const { return star_; }
-
private:
Browser* browser() const;
@@ -84,17 +79,6 @@ class CompactLocationBarView : public DropdownBarView,
// BubblePositioner implementation.
virtual gfx::Rect GetLocationStackBounds() const;
- // views::DragController implementation.
- virtual void WriteDragData(View* sender,
- const gfx::Point& press_pt,
- OSExchangeData* data);
- virtual int GetDragOperations(View* sender, const gfx::Point& p);
- virtual bool CanStartDrag(View* sender,
- const gfx::Point& press_pt,
- const gfx::Point& p) {
- return true;
- }
-
CompactLocationBarHost* clb_host() {
return static_cast<CompactLocationBarHost*>(host());
}
@@ -103,7 +87,6 @@ class CompactLocationBarView : public DropdownBarView,
scoped_ptr<AutocompleteEditViewGtk> location_entry_;
views::NativeViewHost* location_entry_view_;
BrowserActionsContainer* browser_actions_;
- ToolbarStarToggle* star_;
DISALLOW_COPY_AND_ASSIGN(CompactLocationBarView);
};
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index b2e314f..23f1c2c 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -26,7 +26,6 @@
#include "chrome/browser/views/tabs/tab.h"
#include "chrome/browser/views/tabs/tab_strip.h"
#include "chrome/browser/views/toolbar_view.h"
-#include "chrome/browser/views/toolbar_star_toggle.h"
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -434,19 +433,6 @@ BaseTabStrip* BrowserView::CreateTabStrip(
return new ChromeosTabStrip(tab_strip_model, this);
}
-void BrowserView::SetStarredState(bool is_starred) {
- ::BrowserView::SetStarredState(is_starred);
- compact_location_bar_host_->GetStarButton()->SetToggled(is_starred);
-}
-
-void BrowserView::ShowBookmarkBubble(const GURL& url, bool already_bookmarked) {
- if (is_compact_style())
- compact_location_bar_host_->GetStarButton()->ShowStarBubble(
- url, !already_bookmarked);
- else
- ::BrowserView::ShowBookmarkBubble(url, already_bookmarked);
-}
-
// views::ButtonListener overrides.
void BrowserView::ButtonPressed(views::Button* sender,
const views::Event& event) {
diff --git a/chrome/browser/chromeos/frame/browser_view.h b/chrome/browser/chromeos/frame/browser_view.h
index 38fceae..3da1239 100644
--- a/chrome/browser/chromeos/frame/browser_view.h
+++ b/chrome/browser/chromeos/frame/browser_view.h
@@ -65,8 +65,6 @@ class BrowserView : public ::BrowserView,
virtual void ToggleCompactNavigationBar();
virtual views::LayoutManager* CreateLayoutManager() const;
virtual BaseTabStrip* CreateTabStrip(TabStripModel* tab_strip_model);
- virtual void SetStarredState(bool is_starred);
- virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked);
// views::ButtonListener overrides.
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm
index 3cbc49f..fddf185 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.mm
+++ b/chrome/browser/cocoa/location_bar_view_mac.mm
@@ -619,11 +619,11 @@ LocationBarViewMac::StarIconView::StarIconView(CommandUpdater* command_updater)
void LocationBarViewMac::StarIconView::SetStarred(bool starred) {
if (starred) {
- SetIcon(IDR_STARRED_NOBORDER_CENTER);
+ SetIcon(IDR_STARRED);
tooltip_.reset(
[l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_STARRED) retain]);
} else {
- SetIcon(IDR_STAR_NOBORDER_CENTER);
+ SetIcon(IDR_STAR);
tooltip_.reset(
[l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_STAR) retain]);
}
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index 7cb2c66..7c09a491 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -508,8 +508,7 @@ void BrowserToolbarGtk::BuildReloadButton() {
GTK_WIDGET_UNSET_FLAGS(reload_.get(), GTK_CAN_FOCUS);
reload_painter_.reset(new CustomDrawButtonBase(theme_provider_,
- IDR_RELOAD_ENDCAP, IDR_RELOAD_ENDCAP_P, IDR_RELOAD_ENDCAP_H,
- 0, IDR_STAR_MASK));
+ IDR_RELOAD, IDR_RELOAD_P, IDR_RELOAD_H, 0, IDR_RELOAD_MASK));
reload_hover_controller_.Init(reload_.get());
}
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 57e150c..3889fa7 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -941,8 +941,7 @@ void LocationBarViewGtk::SetStarred(bool starred) {
void LocationBarViewGtk::UpdateStarIcon() {
gtk_image_set_from_pixbuf(GTK_IMAGE(star_image_),
- theme_provider_->GetPixbufNamed(starred_ ? IDR_STARRED_NOBORDER_CENTER :
- IDR_STAR_NOBORDER_CENTER));
+ theme_provider_->GetPixbufNamed(starred_ ? IDR_STARRED : IDR_STAR));
}
void LocationBarViewGtk::AdjustChildrenVisibility() {
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index b8cdb89..f8e5b9c 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -8,20 +8,13 @@
#include <gtk/gtk.h>
#endif
-#include "app/drag_drop_types.h"
#include "app/l10n_util.h"
-#include "app/os_exchange_data.h"
#include "app/resource_bundle.h"
-#include "base/command_line.h"
#include "base/i18n/rtl.h"
-#include "base/keyboard_codes.h"
-#include "base/time.h"
-#include "build/build_config.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/app_modal_dialog_queue.h"
#include "chrome/browser/automation/ui_controls.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
-#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_theme_provider.h"
@@ -30,39 +23,29 @@
#include "chrome/browser/ntp_background_util.h"
#include "chrome/browser/page_info_window.h"
#include "chrome/browser/pref_service.h"
-#include "chrome/browser/profile.h"
+#include "chrome/browser/sessions/tab_restore_service.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/bookmark_bar_view.h"
-#include "chrome/browser/views/browser_bubble.h"
#include "chrome/browser/views/browser_dialogs.h"
-#include "chrome/browser/views/chrome_views_delegate.h"
#include "chrome/browser/views/download_shelf_view.h"
#include "chrome/browser/views/extensions/extension_shelf.h"
-#include "chrome/browser/views/frame/browser_view_layout.h"
#include "chrome/browser/views/frame/browser_extender.h"
-#include "chrome/browser/views/frame/browser_frame.h"
+#include "chrome/browser/views/frame/browser_view_layout.h"
#include "chrome/browser/views/fullscreen_exit_bubble.h"
-#include "chrome/browser/views/infobars/infobar_container.h"
#include "chrome/browser/views/status_bubble_views.h"
#include "chrome/browser/views/tab_contents/tab_contents_container.h"
#include "chrome/browser/views/tabs/browser_tab_strip_controller.h"
#include "chrome/browser/views/tabs/side_tab_strip.h"
-#include "chrome/browser/views/tabs/tab_strip.h"
#include "chrome/browser/views/theme_install_bubble_view.h"
-#include "chrome/browser/views/toolbar_star_toggle.h"
#include "chrome/browser/views/toolbar_view.h"
-#include "chrome/browser/sessions/tab_restore_service.h"
-#include "chrome/browser/tab_contents/navigation_entry.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/window_sizer.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/native_window_notification_source.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "gfx/canvas.h"
-#include "gfx/scrollbar_size.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -70,14 +53,11 @@
#include "grit/theme_resources.h"
#include "grit/webkit_resources.h"
#include "views/controls/single_split_view.h"
-#include "views/fill_layout.h"
#include "views/focus/external_focus_tracker.h"
#include "views/focus/view_storage.h"
#include "views/grid_layout.h"
-#include "views/view.h"
#include "views/widget/root_view.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/non_client_view.h"
#include "views/window/window.h"
#if defined(OS_WIN)
@@ -779,7 +759,7 @@ void BrowserView::UpdateLoadingAnimations(bool should_animate) {
}
void BrowserView::SetStarredState(bool is_starred) {
- toolbar_->star_button()->SetToggled(is_starred);
+ toolbar_->location_bar()->SetStarToggled(is_starred);
}
gfx::Rect BrowserView::GetRestoredBounds() const {
@@ -959,7 +939,7 @@ void BrowserView::ShowBookmarkManager() {
}
void BrowserView::ShowBookmarkBubble(const GURL& url, bool already_bookmarked) {
- toolbar_->star_button()->ShowStarBubble(url, !already_bookmarked);
+ toolbar_->location_bar()->ShowStarBubble(url, !already_bookmarked);
}
void BrowserView::SetDownloadShelfVisible(bool visible) {
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index a31e604..588c6e9 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -16,7 +16,6 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/alternate_nav_url_fetcher.h"
#include "chrome/browser/browser_list.h"
-#include "chrome/browser/browser_window.h"
#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/content_setting_bubble_model.h"
@@ -26,17 +25,14 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/view_ids.h"
-#include "chrome/browser/views/extensions/extension_popup.h"
-#include "chrome/browser/views/frame/browser_view.h"
+#include "chrome/browser/views/browser_dialogs.h"
#include "chrome/browser/views/content_blocked_bubble_contents.h"
-#include "chrome/common/content_settings.h"
+#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/common/platform_util.h"
-#include "chrome/common/pref_names.h"
#include "gfx/canvas.h"
#include "gfx/color_utils.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
-#include "net/base/net_util.h"
#if defined(OS_WIN)
#include "chrome/browser/views/first_run_bubble.h"
@@ -140,6 +136,7 @@ LocationBarView::LocationBarView(Profile* profile,
selected_keyword_view_(profile),
keyword_hint_view_(profile),
type_to_search_view_(l10n_util::GetString(IDS_OMNIBOX_EMPTY_TEXT)),
+ star_view_(command_updater),
popup_window_mode_(popup_window_mode),
first_run_bubble_(this),
bubble_positioner_(bubble_positioner) {
@@ -225,6 +222,10 @@ void LocationBarView::Init() {
content_blocked_view->SetVisible(false);
}
+ AddChildView(&star_view_);
+ star_view_.SetVisible(true);
+ star_view_.set_parent_owned(false);
+
// Notify us when any ancestor is resized. In this case we want to tell the
// AutocompleteEditView to close its popup.
SetNotifyWhenVisibleBoundsInRootChanges(true);
@@ -388,6 +389,20 @@ views::View* LocationBarView::GetPageActionView(
return NULL;
}
+void LocationBarView::SetStarToggled(bool on) {
+ star_view_.SetToggled(on);
+}
+
+void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
+ gfx::Rect bounds(bubble_positioner_->GetLocationStackBounds());
+ gfx::Point location;
+ views::View::ConvertPointToScreen(&star_view_, &location);
+ bounds.set_x(location.x());
+ bounds.set_width(star_view_.width());
+ browser::ShowBookmarkBubbleView(GetWindow(), bounds, &star_view_, profile_,
+ url, newly_bookmarked);
+}
+
gfx::Size LocationBarView::GetPreferredSize() {
return gfx::Size(0,
(popup_window_mode_ ? kPopupBackground : kBackground)->height());
@@ -413,6 +428,7 @@ void LocationBarView::Layout() {
entry_width -= location_icon_width + kInnerPadding;
}
+ entry_width -= star_view_.GetPreferredSize().width() + kInnerPadding;
for (PageActionViews::const_iterator i(page_action_views_.begin());
i != page_action_views_.end(); ++i) {
if ((*i)->IsVisible())
@@ -474,6 +490,11 @@ void LocationBarView::Layout() {
// Lay out items to the right of the edit field.
int offset = width() - kEntryPadding;
+ int star_width = star_view_.GetPreferredSize().width();
+ offset -= star_width;
+ star_view_.SetBounds(offset, location_y, star_width, location_height);
+ offset -= kInnerPadding;
+
for (PageActionViews::const_iterator i(page_action_views_.begin());
i != page_action_views_.end(); ++i) {
if ((*i)->IsVisible()) {
@@ -1127,8 +1148,8 @@ void LocationBarView::ContentSettingImageView::UpdateFromTabContents(
return;
}
if (old_icon != content_setting_image_model_->get_icon()) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- SetImage(rb.GetBitmapNamed(content_setting_image_model_->get_icon()));
+ SetImage(ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ content_setting_image_model_->get_icon()));
}
SetTooltipText(UTF8ToWide(content_setting_image_model_->get_tooltip()));
SetVisible(true);
@@ -1136,15 +1157,26 @@ void LocationBarView::ContentSettingImageView::UpdateFromTabContents(
bool LocationBarView::ContentSettingImageView::OnMousePressed(
const views::MouseEvent& event) {
+ // We want to show the bubble on mouse release; that is the standard behavior
+ // for buttons.
+ return true;
+}
+
+void LocationBarView::ContentSettingImageView::OnMouseReleased(
+ const views::MouseEvent& event,
+ bool canceled) {
+ if (canceled)
+ return;
+
+ TabContents* tab_contents = parent_->GetTabContents();
+ if (!tab_contents)
+ return;
+
gfx::Rect bounds(bubble_positioner_->GetLocationStackBounds());
gfx::Point location;
views::View::ConvertPointToScreen(this, &location);
bounds.set_x(location.x());
bounds.set_width(width());
-
- TabContents* tab_contents = parent_->GetTabContents();
- if (!tab_contents)
- return true;
ContentSettingBubbleContents* bubble_contents =
new ContentSettingBubbleContents(
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
@@ -1154,7 +1186,6 @@ bool LocationBarView::ContentSettingImageView::OnMousePressed(
DCHECK(!info_bubble_);
info_bubble_ = InfoBubble::Show(GetWindow(), bounds, bubble_contents, this);
bubble_contents->set_info_bubble(info_bubble_);
- return true;
}
void LocationBarView::ContentSettingImageView::VisibilityChanged(
@@ -1264,9 +1295,9 @@ void LocationBarView::PageActionImageView::ExecuteAction(int button,
bool LocationBarView::PageActionImageView::OnMousePressed(
const views::MouseEvent& event) {
- // We are interested in capturing mouse messages, but we want want to wait
- // until mouse-up because we might show a context menu. Doing so on mouse-down
- // causes weird bugs like http://crbug.com/33155.
+ // We want to show the bubble on mouse release; that is the standard behavior
+ // for buttons. (Also, triggering on mouse press causes bugs like
+ // http://crbug.com/33155.)
return true;
}
@@ -1387,6 +1418,51 @@ void LocationBarView::PageActionImageView::HidePopup() {
popup_->Close();
}
+// StarView---------------------------------------------------------------------
+
+LocationBarView::StarView::StarView(CommandUpdater* command_updater)
+ : command_updater_(command_updater) {
+ SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_STAR));
+ SetID(VIEW_ID_STAR_BUTTON);
+ SetToggled(false);
+}
+
+LocationBarView::StarView::~StarView() {
+}
+
+void LocationBarView::StarView::SetToggled(bool on) {
+ SetTooltipText(l10n_util::GetString(
+ on ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR));
+ SetImage(ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ on ? IDR_STARRED : IDR_STAR));
+}
+
+bool LocationBarView::StarView::GetAccessibleRole(
+ AccessibilityTypes::Role* role) {
+ *role = AccessibilityTypes::ROLE_PUSHBUTTON;
+ return true;
+}
+
+bool LocationBarView::StarView::OnMousePressed(const views::MouseEvent& event) {
+ // We want to show the bubble on mouse release; that is the standard behavior
+ // for buttons.
+ return true;
+}
+
+void LocationBarView::StarView::OnMouseReleased(const views::MouseEvent& event,
+ bool canceled) {
+ if (!canceled)
+ command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE);
+}
+
+void LocationBarView::StarView::InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape) {
+}
+
+bool LocationBarView::StarView::CloseOnEscape() {
+ return true;
+}
+
////////////////////////////////////////////////////////////////////////////////
// LocationBarView, LocationBar implementation:
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index 8ba1226..09c4cb9 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -118,6 +118,12 @@ class LocationBarView : public LocationBar,
// Retrieves the PageAction View which is associated with |page_action|.
views::View* GetPageActionView(ExtensionAction* page_action);
+ // Toggles the star on or off.
+ void SetStarToggled(bool on);
+
+ // Shows the bookmark bubble.
+ void ShowStarBubble(const GURL& url, bool newly_bookmarked);
+
// Sizing functions
virtual gfx::Size GetPreferredSize();
@@ -308,6 +314,7 @@ class LocationBarView : public LocationBar,
private:
// views::ImageView overrides:
virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
virtual void VisibilityChanged(View* starting_from, bool is_visible);
// InfoBubbleDelegate overrides:
@@ -426,6 +433,31 @@ class LocationBarView : public LocationBar,
friend class PageActionWithBadgeView;
typedef std::vector<PageActionWithBadgeView*> PageActionViews;
+ class StarView : public views::ImageView, public InfoBubbleDelegate {
+ public:
+ explicit StarView(CommandUpdater* command_updater);
+ virtual ~StarView();
+
+ // Toggles the star on or off.
+ void SetToggled(bool on);
+
+ private:
+ // views::ImageView overrides:
+ virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+
+ // InfoBubbleDelegate overrides:
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape();
+
+ // The CommandUpdater for the Browser object that owns the location bar.
+ CommandUpdater* command_updater_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StarView);
+ };
+
// Returns the height in pixels of the margin at the top of the bar.
int TopMargin() const;
@@ -535,6 +567,9 @@ class LocationBarView : public LocationBar,
// The page action icon views.
PageActionViews page_action_views_;
+ // The star.
+ StarView star_view_;
+
// When true, the location bar view is read only and also is has a slightly
// different presentation (font size / color). This is used for popups.
bool popup_window_mode_;
diff --git a/chrome/browser/views/toolbar_star_toggle.cc b/chrome/browser/views/toolbar_star_toggle.cc
deleted file mode 100644
index 710d6fa..0000000
--- a/chrome/browser/views/toolbar_star_toggle.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2006-2008 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/views/toolbar_star_toggle.h"
-
-#include "app/l10n_util.h"
-#include "app/resource_bundle.h"
-#include "chrome/app/chrome_dll_resource.h"
-#include "chrome/browser/bookmarks/bookmark_model.h"
-#include "chrome/browser/browser.h"
-#include "chrome/browser/browser_theme_provider.h"
-#include "chrome/browser/bubble_positioner.h"
-#include "chrome/browser/profile.h"
-#include "chrome/browser/views/browser_dialogs.h"
-#include "chrome/browser/view_ids.h"
-#include "googleurl/src/gurl.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-
-using base::TimeTicks;
-
-// The amount of time (in milliseconds) between when the bubble closes and when
-// pressing on the button again does something. Yes, this is a hackish. I tried
-// many different options, all to no avail:
-// . Keying off mouse activation: this didn't work as there is no way to know
-// which window receives the activation. Additionally once the mouse
-// activation occurs we have no way to tie the next mouse event to the mouse
-// activation.
-// . Watching all events as we dispatch them in the MessageLoop. Mouse
-// activation isn't an observable event though.
-// Ideally we could use mouse capture for this, but we can't use mouse capture
-// with the bubble because it has other native windows.
-static const int64 kDisallowClickMS = 40;
-
-ToolbarStarToggle::ToolbarStarToggle(views::ButtonListener* listener)
- : ToggleImageButton(listener),
- profile_(NULL),
- host_view_(NULL),
- bubble_positioner_(NULL),
- ignore_click_(false) {
-}
-
-void ToolbarStarToggle::Init() {
- set_tag(IDC_BOOKMARK_PAGE);
- SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_STAR));
- SetToggledTooltipText(l10n_util::GetString(IDS_TOOLTIP_STARRED));
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_STAR));
- SetID(VIEW_ID_STAR_BUTTON);
-}
-
-void ToolbarStarToggle::LoadImages() {
- ThemeProvider* tp = profile_->GetThemeProvider();
-
- // Load images.
- SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND);
- SkBitmap* background = tp->GetBitmapNamed(IDR_THEME_BUTTON_BACKGROUND);
-
- SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_STAR));
- SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_STAR_H));
- SetImage(views::CustomButton::BS_PUSHED, tp->GetBitmapNamed(IDR_STAR_P));
- SetImage(views::CustomButton::BS_DISABLED, tp->GetBitmapNamed(IDR_STAR_D));
- SetToggledImage(views::CustomButton::BS_NORMAL,
- tp->GetBitmapNamed(IDR_STARRED));
- SetToggledImage(views::CustomButton::BS_HOT,
- tp->GetBitmapNamed(IDR_STARRED_H));
- SetToggledImage(views::CustomButton::BS_PUSHED,
- tp->GetBitmapNamed(IDR_STARRED_P));
- SetBackground(color, background, tp->GetBitmapNamed(IDR_STAR_MASK));
-}
-
-void ToolbarStarToggle::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
- gfx::Rect bounds(bubble_positioner_->GetLocationStackBounds());
- gfx::Point star_location;
- views::View::ConvertPointToScreen(this, &star_location);
- // The visual center of the star is not centered within the bounds. The star
- // has a single central pixel; there are 13 pixels on the "inside" side of it
- // (toward the location bar) and 16 on the "outside". This means we need to
- // shift the bounds one pixel toward the location bar in order to place the
- // star's outside edge at the horizontal center. However, even this isn't
- // good enough in RTL mode, because the InfoBubble's arrow's central pixel is
- // drawn with its left edge on the target rect center-line in both LTR and RTL
- // modes. So in RTL mode, we need to shift the bounds one more pixel left, in
- // order to place the star's central pixel on the right side of the bounds'
- // center-line, so that the arrow's center will line up.
- //
- // TODO(pkasting): If the InfoBubble used mirroring transformations maybe this
- // could become symmetric (-1 : 1).
- bounds.set_x(star_location.x() + (UILayoutIsRightToLeft() ? -2 : 1));
- bounds.set_width(width());
- browser::ShowBookmarkBubbleView(host_view_->GetWindow(), bounds, this,
- profile_, url, newly_bookmarked);
-}
-
-bool ToolbarStarToggle::OnMousePressed(const views::MouseEvent& e) {
- ignore_click_ = ((TimeTicks::Now() - bubble_closed_time_).InMilliseconds() <
- kDisallowClickMS);
- return ToggleImageButton::OnMousePressed(e);
-}
-
-void ToolbarStarToggle::OnMouseReleased(const views::MouseEvent& e,
- bool canceled) {
- ToggleImageButton::OnMouseReleased(e, canceled);
- ignore_click_ = false;
-}
-
-void ToolbarStarToggle::OnDragDone() {
- ToggleImageButton::OnDragDone();
- ignore_click_ = false;
-}
-
-void ToolbarStarToggle::NotifyClick(const views::Event& event) {
- if (!ignore_click_ && !browser::IsBookmarkBubbleViewShowing())
- ToggleImageButton::NotifyClick(event);
-}
-
-SkBitmap ToolbarStarToggle::GetImageToPaint() {
- if (browser::IsBookmarkBubbleViewShowing()) {
- ResourceBundle &rb = ResourceBundle::GetSharedInstance();
- return *rb.GetBitmapNamed(IDR_STARRED_P);
- }
- return ImageButton::GetImageToPaint();
-}
-
-void ToolbarStarToggle::InfoBubbleClosing(InfoBubble* info_bubble,
- bool closed_by_escape) {
- SchedulePaint();
- bubble_closed_time_ = TimeTicks::Now();
-}
-
-bool ToolbarStarToggle::CloseOnEscape() {
- return true;
-}
diff --git a/chrome/browser/views/toolbar_star_toggle.h b/chrome/browser/views/toolbar_star_toggle.h
deleted file mode 100644
index 4966655..0000000
--- a/chrome/browser/views/toolbar_star_toggle.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2010 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_VIEWS_TOOLBAR_STAR_TOGGLE_H_
-#define CHROME_BROWSER_VIEWS_TOOLBAR_STAR_TOGGLE_H_
-
-#include "base/time.h"
-#include "chrome/browser/views/info_bubble.h"
-#include "views/controls/button/image_button.h"
-
-class BubblePositioner;
-class GURL;
-class Profile;
-
-namespace views {
-class ButtonListener;
-class View;
-} // namespace views
-
-// ToolbarStarToggle is used for the star button on the toolbar, allowing the
-// user to star the current page. ToolbarStarToggle manages showing the
-// InfoBubble and rendering the appropriate state while the bubble is visible.
-
-class ToolbarStarToggle : public views::ToggleImageButton,
- public InfoBubbleDelegate {
- public:
- explicit ToolbarStarToggle(views::ButtonListener* listener);
-
- void set_profile(Profile* profile) { profile_ = profile; }
- void set_host_view(views::View* host_view) { host_view_ = host_view; }
- void set_bubble_positioner(BubblePositioner* bubble_positioner) {
- bubble_positioner_ = bubble_positioner;
- }
-
- // Sets up all labels for the button.
- void Init();
-
- // Sets up all images for the button.
- void LoadImages();
-
- // If the bubble isn't showing, shows it.
- void ShowStarBubble(const GURL& url, bool newly_bookmarked);
-
- // Overridden to update ignore_click_ based on whether the mouse was clicked
- // quickly after the bubble was hidden.
- virtual bool OnMousePressed(const views::MouseEvent& e);
-
- // Overridden to set ignore_click_ to false.
- virtual void OnMouseReleased(const views::MouseEvent& e, bool canceled);
- virtual void OnDragDone();
-
- protected:
- // Only invokes super if ignore_click_ is true and the bubble isn't showing.
- virtual void NotifyClick(const views::Event& event);
-
- // Overridden to so that we appear pressed while the bubble is showing.
- virtual SkBitmap GetImageToPaint();
-
- private:
- // InfoBubbleDelegate.
- virtual void InfoBubbleClosing(InfoBubble* info_bubble,
- bool closed_by_escape);
- virtual bool CloseOnEscape();
-
- // Profile with bookmarks info.
- Profile* profile_;
-
- // View that hosts us.
- views::View* host_view_;
-
- // Positioner for bookmark bubble.
- BubblePositioner* bubble_positioner_;
-
- // Time the bubble last closed.
- base::TimeTicks bubble_closed_time_;
-
- // If true NotifyClick does nothing. This is set in OnMousePressed based on
- // the amount of time between when the bubble clicked and now.
- bool ignore_click_;
-
- DISALLOW_COPY_AND_ASSIGN(ToolbarStarToggle);
-};
-
-#endif // CHROME_BROWSER_VIEWS_TOOLBAR_STAR_TOGGLE_H_
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 52854e67..97224d1 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -4,42 +4,20 @@
#include "chrome/browser/views/toolbar_view.h"
-#include <algorithm>
-#include <string>
-
-#include "app/drag_drop_types.h"
#include "app/l10n_util.h"
-#include "app/os_exchange_data.h"
#include "app/resource_bundle.h"
#include "base/command_line.h"
-#include "base/keyboard_codes.h"
-#include "base/logging.h"
-#include "base/path_service.h"
#include "chrome/app/chrome_dll_resource.h"
-#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser.h"
-#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_theme_provider.h"
#include "chrome/browser/browser_window.h"
-#include "chrome/browser/character_encoding.h"
-#include "chrome/browser/defaults.h"
-#include "chrome/browser/encoding_menu_controller.h"
-#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/sync_ui_util.h"
-#include "chrome/browser/tab_contents/navigation_controller.h"
-#include "chrome/browser/tab_contents/navigation_entry.h"
+#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/bookmark_menu_button.h"
#include "chrome/browser/views/browser_actions_container.h"
#include "chrome/browser/views/event_utils.h"
#include "chrome/browser/views/frame/browser_view.h"
-#include "chrome/browser/views/go_button.h"
-#include "chrome/browser/views/location_bar_view.h"
-#include "chrome/browser/views/toolbar_star_toggle.h"
-#include "chrome/browser/view_ids.h"
-#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
@@ -47,12 +25,7 @@
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
-#include "net/base/net_util.h"
-#include "views/background.h"
#include "views/controls/button/button_dropdown.h"
-#include "views/controls/label.h"
-#include "views/controls/menu/menu_2.h"
-#include "views/drag_utils.h"
#include "views/focus/view_storage.h"
#include "views/widget/tooltip_manager.h"
#include "views/window/non_client_view.h"
@@ -82,9 +55,8 @@ ToolbarView::ToolbarView(Browser* browser)
: model_(browser->toolbar_model()),
back_(NULL),
forward_(NULL),
- reload_(NULL),
home_(NULL),
- star_(NULL),
+ reload_(NULL),
location_bar_(NULL),
go_(NULL),
browser_actions_(NULL),
@@ -100,9 +72,8 @@ ToolbarView::ToolbarView(Browser* browser)
SetID(VIEW_ID_TOOLBAR);
browser_->command_updater()->AddCommandObserver(IDC_BACK, this);
browser_->command_updater()->AddCommandObserver(IDC_FORWARD, this);
- browser_->command_updater()->AddCommandObserver(IDC_RELOAD, this);
browser_->command_updater()->AddCommandObserver(IDC_HOME, this);
- browser_->command_updater()->AddCommandObserver(IDC_BOOKMARK_PAGE, this);
+ browser_->command_updater()->AddCommandObserver(IDC_RELOAD, this);
if (browser->type() == Browser::TYPE_NORMAL)
display_mode_ = DISPLAYMODE_NORMAL;
else
@@ -296,14 +267,11 @@ void ToolbarView::EnabledStateChangedForCommand(int id, bool enabled) {
case IDC_FORWARD:
button = forward_;
break;
- case IDC_RELOAD:
- button = reload_;
- break;
case IDC_HOME:
button = home_;
break;
- case IDC_BOOKMARK_PAGE:
- button = star_;
+ case IDC_RELOAD:
+ button = reload_;
break;
}
if (button)
@@ -313,8 +281,8 @@ void ToolbarView::EnabledStateChangedForCommand(int id, bool enabled) {
////////////////////////////////////////////////////////////////////////////////
// ToolbarView, views::Button::ButtonListener implementation:
-void ToolbarView::ButtonPressed(
- views::Button* sender, const views::Event& event) {
+void ToolbarView::ButtonPressed(views::Button* sender,
+ const views::Event& event) {
int id = sender->tag();
switch (id) {
case IDC_BACK:
@@ -347,10 +315,10 @@ gfx::Rect ToolbarView::GetLocationStackBounds() const {
const int kLocationStackEdgeWidth = 2;
gfx::Point origin;
- views::View::ConvertPointToScreen(star_, &origin);
+ views::View::ConvertPointToScreen(reload_, &origin);
gfx::Rect stack_bounds(origin.x(), origin.y(),
- star_->width() + location_bar_->width() + go_->width(),
- location_bar_->height());
+ reload_->width() + location_bar_->width() + go_->width(),
+ location_bar_->height());
if (UILayoutIsRightToLeft()) {
stack_bounds.set_x(
stack_bounds.x() - location_bar_->width() - go_->width());
@@ -456,11 +424,12 @@ gfx::Size ToolbarView::GetPreferredSize() {
if (IsDisplayModeNormal()) {
int min_width = kControlIndent + back_->GetPreferredSize().width() +
forward_->GetPreferredSize().width() + kControlHorizOffset +
- reload_->GetPreferredSize().width() + (show_home_button_.GetValue() ?
- (home_->GetPreferredSize().width() + kControlHorizOffset) : 0) +
- star_->GetPreferredSize().width() + go_->GetPreferredSize().width() +
- kMenuButtonOffset +
+ (show_home_button_.GetValue() ?
+ (home_->GetPreferredSize().width() + kControlHorizOffset) : 0) +
+ reload_->GetPreferredSize().width() +
browser_actions_->GetPreferredSize().width() +
+ go_->GetPreferredSize().width() +
+ kMenuButtonOffset +
(bookmark_menu_ ? bookmark_menu_->GetPreferredSize().width() : 0) +
page_menu_->GetPreferredSize().width() +
app_menu_->GetPreferredSize().width() + kPaddingRight;
@@ -515,21 +484,18 @@ void ToolbarView::Layout() {
forward_->SetBounds(back_->x() + back_->width(), child_y,
forward_->GetPreferredSize().width(), child_height);
- reload_->SetBounds(forward_->x() + forward_->width() + kControlHorizOffset,
- child_y, reload_->GetPreferredSize().width(),
- child_height);
-
if (show_home_button_.GetValue()) {
home_->SetVisible(true);
- home_->SetBounds(reload_->x() + reload_->width() + kControlHorizOffset,
+ home_->SetBounds(forward_->x() + forward_->width() + kControlHorizOffset,
child_y, home_->GetPreferredSize().width(), child_height);
} else {
home_->SetVisible(false);
- home_->SetBounds(reload_->x() + reload_->width(), child_y, 0, child_height);
+ home_->SetBounds(forward_->x() + forward_->width(), child_y, 0,
+ child_height);
}
- star_->SetBounds(home_->x() + home_->width() + kControlHorizOffset,
- child_y, star_->GetPreferredSize().width(), child_height);
+ reload_->SetBounds(home_->x() + home_->width() + kControlHorizOffset, child_y,
+ reload_->GetPreferredSize().width(), child_height);
int go_button_width = go_->GetPreferredSize().width();
int browser_actions_width = browser_actions_->GetPreferredSize().width();
@@ -537,7 +503,7 @@ void ToolbarView::Layout() {
int app_menu_width = app_menu_->GetPreferredSize().width();
int bookmark_menu_width = bookmark_menu_ ?
bookmark_menu_->GetPreferredSize().width() : 0;
- int location_x = star_->x() + star_->width();
+ int location_x = reload_->x() + reload_->width();
int available_width = width() - kPaddingRight - bookmark_menu_width -
app_menu_width - page_menu_width - browser_actions_width -
kMenuButtonOffset - go_button_width - location_x;
@@ -604,51 +570,6 @@ void ToolbarView::ThemeChanged() {
}
////////////////////////////////////////////////////////////////////////////////
-// ToolbarView, views::DragController implementation:
-
-void ToolbarView::WriteDragData(views::View* sender,
- const gfx::Point& press_pt,
- OSExchangeData* data) {
- DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE);
-
- UserMetrics::RecordAction(UserMetricsAction("Toolbar_DragStar"), profile_);
-
- // If there is a bookmark for the URL, add the bookmark drag data for it. We
- // do this to ensure the bookmark is moved, rather than creating an new
- // bookmark.
- TabContents* tab = browser_->GetSelectedTabContents();
- if (tab) {
- if (profile_ && profile_->GetBookmarkModel()) {
- const BookmarkNode* node = profile_->GetBookmarkModel()->
- GetMostRecentlyAddedNodeForURL(tab->GetURL());
- if (node) {
- BookmarkDragData bookmark_data(node);
- bookmark_data.Write(profile_, data);
- }
- }
-
- drag_utils::SetURLAndDragImage(tab->GetURL(),
- UTF16ToWideHack(tab->GetTitle()),
- tab->GetFavIcon(),
- data);
- }
-}
-
-int ToolbarView::GetDragOperations(views::View* sender, const gfx::Point& p) {
- DCHECK(sender == star_);
- TabContents* tab = browser_->GetSelectedTabContents();
- if (!tab || !tab->ShouldDisplayURL() || !tab->GetURL().is_valid()) {
- return DragDropTypes::DRAG_NONE;
- }
- if (profile_ && profile_->GetBookmarkModel() &&
- profile_->GetBookmarkModel()->IsBookmarked(tab->GetURL())) {
- return DragDropTypes::DRAG_MOVE | DragDropTypes::DRAG_COPY |
- DragDropTypes::DRAG_LINK;
- }
- return DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK;
-}
-
-////////////////////////////////////////////////////////////////////////////////
// ToolbarView, private:
int ToolbarView::PopupTopSpacing() const {
@@ -675,12 +596,6 @@ void ToolbarView::CreateLeftSideControls() {
forward_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_FORWARD));
forward_->SetID(VIEW_ID_FORWARD_BUTTON);
- reload_ = new views::ImageButton(this);
- reload_->set_tag(IDC_RELOAD);
- reload_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_RELOAD));
- reload_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RELOAD));
- reload_->SetID(VIEW_ID_RELOAD_BUTTON);
-
home_ = new views::ImageButton(this);
home_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
views::Event::EF_MIDDLE_BUTTON_DOWN);
@@ -693,17 +608,15 @@ void ToolbarView::CreateLeftSideControls() {
AddChildView(back_);
AddChildView(forward_);
- AddChildView(reload_);
AddChildView(home_);
}
void ToolbarView::CreateCenterStack(Profile *profile) {
- star_ = new ToolbarStarToggle(this);
- star_->SetDragController(this);
- star_->set_profile(profile);
- star_->set_host_view(this);
- star_->set_bubble_positioner(this);
- star_->Init();
+ reload_ = new views::ImageButton(this);
+ reload_->set_tag(IDC_RELOAD);
+ reload_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_RELOAD));
+ reload_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RELOAD));
+ reload_->SetID(VIEW_ID_RELOAD_BUTTON);
location_bar_ = new LocationBarView(profile, browser_->command_updater(),
model_, this,
@@ -717,7 +630,7 @@ void ToolbarView::CreateCenterStack(Profile *profile) {
LoadCenterStackImages();
- AddChildView(star_);
+ AddChildView(reload_);
location_bar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_LOCATION));
AddChildView(location_bar_);
location_bar_->Init();
@@ -779,15 +692,6 @@ void ToolbarView::LoadLeftSideControlsImages() {
forward_->SetBackground(color, background,
tp->GetBitmapNamed(IDR_FORWARD_MASK));
- reload_->SetImage(views::CustomButton::BS_NORMAL,
- tp->GetBitmapNamed(IDR_RELOAD));
- reload_->SetImage(views::CustomButton::BS_HOT,
- tp->GetBitmapNamed(IDR_RELOAD_H));
- reload_->SetImage(views::CustomButton::BS_PUSHED,
- tp->GetBitmapNamed(IDR_RELOAD_P));
- reload_->SetBackground(color, background,
- tp->GetBitmapNamed(IDR_BUTTON_MASK));
-
home_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_HOME));
home_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_HOME_H));
home_->SetImage(views::CustomButton::BS_PUSHED,
@@ -797,13 +701,20 @@ void ToolbarView::LoadLeftSideControlsImages() {
}
void ToolbarView::LoadCenterStackImages() {
- star_->LoadImages();
-
ThemeProvider* tp = GetThemeProvider();
SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND);
SkBitmap* background = tp->GetBitmapNamed(IDR_THEME_BUTTON_BACKGROUND);
+ reload_->SetImage(views::CustomButton::BS_NORMAL,
+ tp->GetBitmapNamed(IDR_RELOAD));
+ reload_->SetImage(views::CustomButton::BS_HOT,
+ tp->GetBitmapNamed(IDR_RELOAD_H));
+ reload_->SetImage(views::CustomButton::BS_PUSHED,
+ tp->GetBitmapNamed(IDR_RELOAD_P));
+ reload_->SetBackground(color, background,
+ tp->GetBitmapNamed(IDR_RELOAD_MASK));
+
go_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_GO));
go_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_GO_H));
go_->SetImage(views::CustomButton::BS_PUSHED, tp->GetBitmapNamed(IDR_GO_P));
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index 62faebf..86e3249 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -27,7 +27,6 @@
class BrowserActionsContainer;
class Browser;
class Profile;
-class ToolbarStarToggle;
namespace views {
class Menu2;
@@ -36,7 +35,6 @@ class Menu2;
// The Browser Window's toolbar.
class ToolbarView : public AccessibleToolbarView,
public views::ViewMenuDelegate,
- public views::DragController,
public views::FocusChangeListener,
public menus::SimpleMenuModel::Delegate,
public LocationBarView::Delegate,
@@ -86,7 +84,6 @@ class ToolbarView : public AccessibleToolbarView,
// Accessors...
Browser* browser() const { return browser_; }
BrowserActionsContainer* browser_actions() const { return browser_actions_; }
- ToolbarStarToggle* star_button() const { return star_; }
GoButton* go_button() const { return go_; }
LocationBarView* location_bar() const { return location_bar_; }
views::MenuButton* page_menu() const { return page_menu_; }
@@ -138,17 +135,6 @@ class ToolbarView : public AccessibleToolbarView,
virtual void ThemeChanged();
private:
- // Overridden from views::DragController:
- virtual void WriteDragData(View* sender,
- const gfx::Point& press_pt,
- OSExchangeData* data);
- virtual int GetDragOperations(View* sender, const gfx::Point& p);
- virtual bool CanStartDrag(View* sender,
- const gfx::Point& press_pt,
- const gfx::Point& p) {
- return true;
- }
-
// Returns the number of pixels above the location bar in non-normal display.
int PopupTopSpacing() const;
@@ -198,9 +184,8 @@ class ToolbarView : public AccessibleToolbarView,
// Controls
views::ImageButton* back_;
views::ImageButton* forward_;
- views::ImageButton* reload_;
views::ImageButton* home_;
- ToolbarStarToggle* star_;
+ views::ImageButton* reload_;
LocationBarView* location_bar_;
GoButton* go_;
BrowserActionsContainer* browser_actions_;
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 78e26c1..c5f34f9 100755
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2378,8 +2378,6 @@
'browser/views/theme_helpers.h',
'browser/views/theme_install_bubble_view.cc',
'browser/views/theme_install_bubble_view.h',
- 'browser/views/toolbar_star_toggle.cc',
- 'browser/views/toolbar_star_toggle.h',
'browser/views/toolbar_view.cc',
'browser/views/toolbar_view.h',
'browser/views/uninstall_view.cc',
@@ -2821,8 +2819,6 @@
['include', '^browser/views/html_dialog_view.h'],
['include', '^browser/views/theme_install_bubble_view.cc'],
['include', '^browser/views/theme_install_bubble_view.h'],
- ['include', '^browser/views/toolbar_star_toggle.h'],
- ['include', '^browser/views/toolbar_star_toggle.cc'],
['include', '^browser/views/frame/browser_bubble_host.cc'],
['include', '^browser/views/frame/browser_bubble_host.h'],
['include', '^browser/views/frame/browser_view_layout.cc'],
diff --git a/chrome/test/data/profiles/complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/Cached Theme.pak b/chrome/test/data/profiles/complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/Cached Theme.pak
index ea5d2e1..c3124f7 100644
--- a/chrome/test/data/profiles/complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/Cached Theme.pak
+++ b/chrome/test/data/profiles/complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/Cached Theme.pak
Binary files differ