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

Unified Diff: ash/launcher/tabbed_launcher_button.cc

Issue 9649013: Show a different icon in the launcher for incognito windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Code review fix Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/launcher/tabbed_launcher_button.cc
diff --git a/ash/launcher/tabbed_launcher_button.cc b/ash/launcher/tabbed_launcher_button.cc
index c947144eb71619c660eafeb115f495b75ec285c5..8ecbd6cd0dddf0e27306f63b7e757b55ae2d9891 100644
--- a/ash/launcher/tabbed_launcher_button.cc
+++ b/ash/launcher/tabbed_launcher_button.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "ash/launcher/launcher_button_host.h"
+#include "ash/launcher/launcher_types.h"
#include "grit/ui_resources.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/animation/multi_animation.h"
@@ -45,6 +46,13 @@ TabbedLauncherButton::ImageSet* TabbedLauncherButton::bg_image_1_ = NULL;
TabbedLauncherButton::ImageSet* TabbedLauncherButton::bg_image_2_ = NULL;
TabbedLauncherButton::ImageSet* TabbedLauncherButton::bg_image_3_ = NULL;
+TabbedLauncherButton::ImageSet*
+ TabbedLauncherButton::bg_private_image_1_ = NULL;
+TabbedLauncherButton::ImageSet*
+ TabbedLauncherButton::bg_private_image_2_ = NULL;
+TabbedLauncherButton::ImageSet*
+ TabbedLauncherButton::bg_private_image_3_ = NULL;
+
TabbedLauncherButton::TabbedLauncherButton(views::ButtonListener* listener,
LauncherButtonHost* host)
: views::ImageButton(listener),
@@ -62,6 +70,19 @@ TabbedLauncherButton::TabbedLauncherButton(views::ButtonListener* listener,
bg_image_3_ = CreateImageSet(IDR_AURA_LAUNCHER_TABBED_BROWSER_3,
IDR_AURA_LAUNCHER_TABBED_BROWSER_3_PUSHED,
IDR_AURA_LAUNCHER_TABBED_BROWSER_3_HOT);
+
+ bg_private_image_1_ =
+ CreateImageSet(IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_1,
+ IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_1_PUSHED,
+ IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_1_HOT);
+ bg_private_image_2_ =
+ CreateImageSet(IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_2,
+ IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_2_PUSHED,
+ IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_2_HOT);
+ bg_private_image_3_ =
+ CreateImageSet(IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_3,
+ IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_3_PUSHED,
+ IDR_AURA_LAUNCHER_TABBED_PRIVATE_BROWSER_3_HOT);
}
SetImageAlignment(views::ImageButton::ALIGN_CENTER,
views::ImageButton::ALIGN_MIDDLE);
@@ -85,17 +106,26 @@ void TabbedLauncherButton::PrepareForImageChange() {
animation_->Start();
}
-void TabbedLauncherButton::SetTabImage(const SkBitmap& image, int count) {
+void TabbedLauncherButton::SetTabImage(const LauncherItem& item) {
animation_.reset();
show_image_ = true;
- image_ = image;
+ image_ = item.image;
ImageSet* set;
- if (count <= 1)
- set = bg_image_1_;
- else if (count == 2)
- set = bg_image_2_;
- else
- set = bg_image_3_;
+ if (item.is_incognito) {
+ if (item.num_tabs <= 1)
+ set = bg_private_image_1_;
+ else if (item.num_tabs == 2)
+ set = bg_private_image_2_;
+ else
+ set = bg_private_image_3_;
+ } else {
+ if (item.num_tabs <= 1)
+ set = bg_image_1_;
+ else if (item.num_tabs == 2)
+ set = bg_image_2_;
+ else
+ set = bg_image_3_;
+ }
SetImage(BS_NORMAL, set->normal_image);
SetImage(BS_HOT, set->hot_image);
SetImage(BS_PUSHED, set->pushed_image);

Powered by Google App Engine
This is Rietveld 408576698