| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" | 5 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/launcher/launcher_model.h" | 8 #include "ash/launcher/launcher_model.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_tab_helper.h" | 12 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 13 #include "chrome/browser/favicon/favicon_tab_helper.h" | 13 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 19 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" | 19 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" |
| 20 #include "chrome/browser/web_applications/web_app.h" | 20 #include "chrome/browser/web_applications/web_app.h" |
| 21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 22 #include "grit/ui_resources.h" | 22 #include "grit/ui_resources.h" |
| 23 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
| 24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 26 | 26 |
| 27 BrowserLauncherItemController::BrowserLauncherItemController( | 27 BrowserLauncherItemController::BrowserLauncherItemController( |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 ChromeLauncherController::instance(), type, app_id); | 95 ChromeLauncherController::instance(), type, app_id); |
| 96 icon_updater->Init(); | 96 icon_updater->Init(); |
| 97 return icon_updater; | 97 return icon_updater; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void BrowserLauncherItemController::BrowserActivationStateChanged() { | 100 void BrowserLauncherItemController::BrowserActivationStateChanged() { |
| 101 UpdateItemStatus(); | 101 UpdateItemStatus(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void BrowserLauncherItemController::ActiveTabChanged( | 104 void BrowserLauncherItemController::ActiveTabChanged( |
| 105 TabContentsWrapper* old_contents, | 105 TabContents* old_contents, |
| 106 TabContentsWrapper* new_contents, | 106 TabContents* new_contents, |
| 107 int index, | 107 int index, |
| 108 bool user_gesture) { | 108 bool user_gesture) { |
| 109 // Update immediately on a tab change. | 109 // Update immediately on a tab change. |
| 110 UpdateLauncher(new_contents); | 110 UpdateLauncher(new_contents); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void BrowserLauncherItemController::TabChangedAt( | 113 void BrowserLauncherItemController::TabChangedAt( |
| 114 TabContentsWrapper* tab, | 114 TabContents* tab, |
| 115 int index, | 115 int index, |
| 116 TabStripModelObserver::TabChangeType change_type) { | 116 TabStripModelObserver::TabChangeType change_type) { |
| 117 if (index != tab_model_->active_index() || | 117 if (index != tab_model_->active_index() || |
| 118 !(change_type != TabStripModelObserver::LOADING_ONLY && | 118 !(change_type != TabStripModelObserver::LOADING_ONLY && |
| 119 change_type != TabStripModelObserver::TITLE_NOT_LOADING)) { | 119 change_type != TabStripModelObserver::TITLE_NOT_LOADING)) { |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (tab->favicon_tab_helper()->FaviconIsValid() || | 123 if (tab->favicon_tab_helper()->FaviconIsValid() || |
| 124 !tab->favicon_tab_helper()->ShouldDisplayFavicon()) { | 124 !tab->favicon_tab_helper()->ShouldDisplayFavicon()) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 154 window_->SetProperty(aura::client::kDrawAttentionKey, false); | 154 window_->SetProperty(aura::client::kDrawAttentionKey, false); |
| 155 status = ash::STATUS_ACTIVE; | 155 status = ash::STATUS_ACTIVE; |
| 156 } else if (window_->GetProperty(aura::client::kDrawAttentionKey)) { | 156 } else if (window_->GetProperty(aura::client::kDrawAttentionKey)) { |
| 157 status = ash::STATUS_ATTENTION; | 157 status = ash::STATUS_ATTENTION; |
| 158 } else { | 158 } else { |
| 159 status = ash::STATUS_RUNNING; | 159 status = ash::STATUS_RUNNING; |
| 160 } | 160 } |
| 161 launcher_controller_->SetItemStatus(item_id_, status); | 161 launcher_controller_->SetItemStatus(item_id_, status); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void BrowserLauncherItemController::UpdateLauncher(TabContentsWrapper* tab) { | 164 void BrowserLauncherItemController::UpdateLauncher(TabContents* tab) { |
| 165 if (type_ == TYPE_APP_PANEL) | 165 if (type_ == TYPE_APP_PANEL) |
| 166 return; // Maintained entirely by ChromeLauncherController. | 166 return; // Maintained entirely by ChromeLauncherController. |
| 167 | 167 |
| 168 if (!tab) | 168 if (!tab) |
| 169 return; // Assume the window is going to be closed if there are no tabs. | 169 return; // Assume the window is going to be closed if there are no tabs. |
| 170 | 170 |
| 171 int item_index = launcher_model()->ItemIndexByID(item_id_); | 171 int item_index = launcher_model()->ItemIndexByID(item_id_); |
| 172 if (item_index == -1) | 172 if (item_index == -1) |
| 173 return; | 173 return; |
| 174 | 174 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 200 } else { | 200 } else { |
| 201 item.image = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 201 item.image = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 launcher_model()->Set(item_index, item); | 204 launcher_model()->Set(item_index, item); |
| 205 } | 205 } |
| 206 | 206 |
| 207 ash::LauncherModel* BrowserLauncherItemController::launcher_model() { | 207 ash::LauncherModel* BrowserLauncherItemController::launcher_model() { |
| 208 return launcher_controller_->model(); | 208 return launcher_controller_->model(); |
| 209 } | 209 } |
| OLD | NEW |