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

Side by Side Diff: chrome/browser/ui/views/aura/launcher_icon_updater.cc

Issue 8588020: fix NetInternalsTest.NetInternalsPrerenderViewSucceed for aura (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/aura/launcher_icon_updater.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/aura/launcher_icon_updater.h" 5 #include "chrome/browser/ui/views/aura/launcher_icon_updater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/extensions/extension_tab_helper.h" 9 #include "chrome/browser/extensions/extension_tab_helper.h"
10 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 int index, 79 int index,
80 TabStripModelObserver::TabChangeType change_type) { 80 TabStripModelObserver::TabChangeType change_type) {
81 if (change_type != TabStripModelObserver::LOADING_ONLY && 81 if (change_type != TabStripModelObserver::LOADING_ONLY &&
82 change_type != TabStripModelObserver::TITLE_NOT_LOADING) { 82 change_type != TabStripModelObserver::TITLE_NOT_LOADING) {
83 Tabs::iterator i = std::find(tabs_.begin(), tabs_.end(), tab); 83 Tabs::iterator i = std::find(tabs_.begin(), tabs_.end(), tab);
84 if (i != tabs_.end() && (i - tabs_.begin()) < kMaxCount) 84 if (i != tabs_.end() && (i - tabs_.begin()) < kMaxCount)
85 UpdateLauncher(); 85 UpdateLauncher();
86 } 86 }
87 } 87 }
88 88
89 void LauncherIconUpdater::TabReplacedAt(TabStripModel* tab_strip_model,
90 TabContentsWrapper* old_contents,
91 TabContentsWrapper* new_contents,
92 int index) {
93 Tabs::iterator i = std::find(tabs_.begin(), tabs_.end(), old_contents);
94 if (i != tabs_.end()) {
95 int pos = i - tabs_.begin();
96 tabs_[pos] = new_contents;
97 if (pos < kMaxCount)
98 UpdateLauncher();
99 }
100 }
101
89 void LauncherIconUpdater::UpdateLauncher() { 102 void LauncherIconUpdater::UpdateLauncher() {
90 if (tabs_.empty()) 103 if (tabs_.empty())
91 return; // Assume the window is going to be closed if there are no tabs. 104 return; // Assume the window is going to be closed if there are no tabs.
92 105
93 int item_index = launcher_model_->ItemIndexByWindow(window_); 106 int item_index = launcher_model_->ItemIndexByWindow(window_);
94 if (item_index == -1) 107 if (item_index == -1)
95 return; 108 return;
96 109
97 if (launcher_model_->items()[item_index].type == aura_shell::TYPE_APP) { 110 if (launcher_model_->items()[item_index].type == aura_shell::TYPE_APP) {
98 // Use the app icon if we can. 111 // Use the app icon if we can.
(...skipping 13 matching lines...) Expand all
112 // TODO: needs to be updated for apps. 125 // TODO: needs to be updated for apps.
113 images[i].image = tabs_[i]->favicon_tab_helper()->GetFavicon(); 126 images[i].image = tabs_[i]->favicon_tab_helper()->GetFavicon();
114 if (images[i].image.empty()) { 127 if (images[i].image.empty()) {
115 images[i].image = *ResourceBundle::GetSharedInstance().GetBitmapNamed( 128 images[i].image = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
116 IDR_DEFAULT_FAVICON); 129 IDR_DEFAULT_FAVICON);
117 } 130 }
118 images[i].user_data = tabs_[i]; 131 images[i].user_data = tabs_[i];
119 } 132 }
120 launcher_model_->SetTabbedImages(item_index, images); 133 launcher_model_->SetTabbedImages(item_index, images);
121 } 134 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/aura/launcher_icon_updater.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698