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

Unified Diff: chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc

Issue 10392173: Flash window by pulsing their launcher icon state indicator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 8 years, 7 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: chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc
diff --git a/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc b/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc
index f227d2c3a5eda3ebca3c9dca77c7c2d05661854b..3563c3cc5769c40d60407d202c47b6d932ee29c2 100644
--- a/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc
+++ b/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/web_applications/web_app.h"
#include "content/public/browser/web_contents.h"
#include "grit/ui_resources.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/base/resource/resource_bundle.h"
@@ -37,10 +38,12 @@ BrowserLauncherItemController::BrowserLauncherItemController(
is_incognito_(tab_model->profile()->GetOriginalProfile() !=
tab_model->profile() && !Profile::IsGuestSession()),
item_id_(-1) {
+ window_->AddObserver(this);
}
BrowserLauncherItemController::~BrowserLauncherItemController() {
tab_model_->RemoveObserver(this);
+ window_->RemoveObserver(this);
if (item_id_ != -1)
launcher_controller_->LauncherItemClosed(item_id_);
}
@@ -95,10 +98,7 @@ BrowserLauncherItemController* BrowserLauncherItemController::Create(
}
void BrowserLauncherItemController::BrowserActivationStateChanged() {
- launcher_controller_->SetItemStatus(
- item_id_,
- ash::wm::IsActiveWindow(window_) ?
- ash::STATUS_ACTIVE : ash::STATUS_RUNNING);
+ UpdateItemStatus();
}
void BrowserLauncherItemController::ActiveTabChanged(
@@ -138,6 +138,29 @@ void BrowserLauncherItemController::FaviconUpdated() {
UpdateLauncher(tab_model_->GetActiveTabContents());
}
+void BrowserLauncherItemController::OnWindowPropertyChanged(
+ aura::Window* window,
+ const void* key,
+ intptr_t old) {
+ if (key == aura::client::kDrawAttentionKey)
+ UpdateItemStatus();
+}
+
+void BrowserLauncherItemController::UpdateItemStatus() {
+ ash::LauncherItemStatus status;
+ if (ash::wm::IsActiveWindow(window_)) {
+ // Clear attention state if active.
+ if (window_->GetProperty(aura::client::kDrawAttentionKey))
+ window_->SetProperty(aura::client::kDrawAttentionKey, false);
+ status = ash::STATUS_ACTIVE;
+ } else if (window_->GetProperty(aura::client::kDrawAttentionKey)) {
+ status = ash::STATUS_ATTENTION;
+ } else {
+ status = ash::STATUS_RUNNING;
+ }
+ launcher_controller_->SetItemStatus(item_id_, status);
+}
+
void BrowserLauncherItemController::UpdateLauncher(TabContentsWrapper* tab) {
if (type_ == TYPE_APP_PANEL)
return; // Maintained entirely by ChromeLauncherController.

Powered by Google App Engine
This is Rietveld 408576698