summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/toolbar_view.cc
diff options
context:
space:
mode:
authorbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 19:58:08 +0000
committerbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 19:58:08 +0000
commit997d2ddf7d799efc127fd47eb25838cf0d6305ab (patch)
treeb90b21205b64765bf0cdf8fcbfa4ac1d5e430acd /chrome/browser/ui/views/toolbar_view.cc
parente0995e69127ccd887e80434e6b3aec4bedfa0fd4 (diff)
downloadchromium_src-997d2ddf7d799efc127fd47eb25838cf0d6305ab.zip
chromium_src-997d2ddf7d799efc127fd47eb25838cf0d6305ab.tar.gz
chromium_src-997d2ddf7d799efc127fd47eb25838cf0d6305ab.tar.bz2
Revert 84831 - The initial prototype code for the compact navigation (cnav) prototype, currently only active in windows. This is well hidden behind a flag and a context menu option.
Loosely based off oshima's original prototype patch: http://codereview.chromium.org/165272 BUG=None TEST=Activate the cnav prototype in about:flags. Right click a tab and select "Hide Toolbar" to go into cnav mode. Ensure that the compact location bar provides the same basic functionality as the toolbar (except browser actions). Review URL: http://codereview.chromium.org/6913026 TBR=stevet@chromium.org Review URL: http://codereview.chromium.org/7005004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84836 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views/toolbar_view.cc')
-rw-r--r--chrome/browser/ui/views/toolbar_view.cc110
1 files changed, 55 insertions, 55 deletions
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index 09c6d89..3e62081 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -254,61 +254,6 @@ void ToolbarView::RemoveMenuListener(views::MenuListener* listener) {
}
}
-SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) {
- ui::ThemeProvider* tp = GetThemeProvider();
-
- int id = 0;
- switch (state) {
- case views::CustomButton::BS_NORMAL: id = IDR_TOOLS; break;
- case views::CustomButton::BS_HOT: id = IDR_TOOLS_H; break;
- case views::CustomButton::BS_PUSHED: id = IDR_TOOLS_P; break;
- default: NOTREACHED(); break;
- }
- SkBitmap icon = *tp->GetBitmapNamed(id);
-
-#if defined(OS_WIN)
- // Keep track of whether we were showing the badge before, so we don't send
- // multiple UMA events for example when multiple Chrome windows are open.
- static bool incompatibility_badge_showing = false;
- // Save the old value before resetting it.
- bool was_showing = incompatibility_badge_showing;
- incompatibility_badge_showing = false;
-#endif
-
- bool add_badge = IsUpgradeRecommended() || ShouldShowIncompatibilityWarning();
- if (!add_badge)
- return icon;
-
- // Draw the chrome app menu icon onto the canvas.
- scoped_ptr<gfx::CanvasSkia> canvas(
- new gfx::CanvasSkia(icon.width(), icon.height(), false));
- canvas->DrawBitmapInt(icon, 0, 0);
-
- SkBitmap badge;
- // Only one badge can be active at any given time. The Upgrade notification
- // is deemed most important, then the DLL conflict badge.
- if (IsUpgradeRecommended()) {
- badge = *tp->GetBitmapNamed(
- UpgradeDetector::GetInstance()->GetIconResourceID(
- UpgradeDetector::UPGRADE_ICON_TYPE_BADGE));
- } else if (ShouldShowIncompatibilityWarning()) {
-#if defined(OS_WIN)
- if (!was_showing)
- UserMetrics::RecordAction(UserMetricsAction("ConflictBadge"));
- badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE);
- incompatibility_badge_showing = true;
-#else
- NOTREACHED();
-#endif
- } else {
- NOTREACHED();
- }
-
- canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin);
-
- return canvas->ExtractBitmap();
-}
-
////////////////////////////////////////////////////////////////////////////////
// ToolbarView, AccessiblePaneView overrides:
@@ -710,3 +655,58 @@ void ToolbarView::UpdateAppMenuBadge() {
app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
SchedulePaint();
}
+
+SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) {
+ ui::ThemeProvider* tp = GetThemeProvider();
+
+ int id = 0;
+ switch (state) {
+ case views::CustomButton::BS_NORMAL: id = IDR_TOOLS; break;
+ case views::CustomButton::BS_HOT: id = IDR_TOOLS_H; break;
+ case views::CustomButton::BS_PUSHED: id = IDR_TOOLS_P; break;
+ default: NOTREACHED(); break;
+ }
+ SkBitmap icon = *tp->GetBitmapNamed(id);
+
+#if defined(OS_WIN)
+ // Keep track of whether we were showing the badge before, so we don't send
+ // multiple UMA events for example when multiple Chrome windows are open.
+ static bool incompatibility_badge_showing = false;
+ // Save the old value before resetting it.
+ bool was_showing = incompatibility_badge_showing;
+ incompatibility_badge_showing = false;
+#endif
+
+ bool add_badge = IsUpgradeRecommended() || ShouldShowIncompatibilityWarning();
+ if (!add_badge)
+ return icon;
+
+ // Draw the chrome app menu icon onto the canvas.
+ scoped_ptr<gfx::CanvasSkia> canvas(
+ new gfx::CanvasSkia(icon.width(), icon.height(), false));
+ canvas->DrawBitmapInt(icon, 0, 0);
+
+ SkBitmap badge;
+ // Only one badge can be active at any given time. The Upgrade notification
+ // is deemed most important, then the DLL conflict badge.
+ if (IsUpgradeRecommended()) {
+ badge = *tp->GetBitmapNamed(
+ UpgradeDetector::GetInstance()->GetIconResourceID(
+ UpgradeDetector::UPGRADE_ICON_TYPE_BADGE));
+ } else if (ShouldShowIncompatibilityWarning()) {
+#if defined(OS_WIN)
+ if (!was_showing)
+ UserMetrics::RecordAction(UserMetricsAction("ConflictBadge"));
+ badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE);
+ incompatibility_badge_showing = true;
+#else
+ NOTREACHED();
+#endif
+ } else {
+ NOTREACHED();
+ }
+
+ canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin);
+
+ return canvas->ExtractBitmap();
+}