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

Side by Side Diff: chrome/browser/aeropeek_manager.cc

Issue 6735042: Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_edit.h » ('j') | 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/aeropeek_manager.h" 5 #include "chrome/browser/aeropeek_manager.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shobjidl.h> 8 #include <shobjidl.h>
9 9
10 #include "app/win/shell.h" 10 #include "app/win/shell.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/scoped_native_library.h" 12 #include "base/memory/scoped_native_library.h"
13 #include "base/scoped_comptr_win.h" 13 #include "base/scoped_comptr_win.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "base/win/scoped_gdi_object.h" 15 #include "base/win/scoped_gdi_object.h"
16 #include "base/win/scoped_hdc.h" 16 #include "base/win/scoped_hdc.h"
17 #include "base/win/windows_version.h" 17 #include "base/win/windows_version.h"
18 #include "chrome/browser/app_icon_win.h" 18 #include "chrome/browser/app_icon_win.h"
19 #include "chrome/browser/browser_list.h" 19 #include "chrome/browser/browser_list.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/favicon_tab_helper.h"
21 #include "chrome/browser/tab_contents/thumbnail_generator.h" 22 #include "chrome/browser/tab_contents/thumbnail_generator.h"
22 #include "chrome/browser/tabs/tab_strip_model.h" 23 #include "chrome/browser/tabs/tab_strip_model.h"
23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
24 #include "chrome/common/chrome_constants.h" 25 #include "chrome/common/chrome_constants.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
26 #include "chrome/installer/util/browser_distribution.h" 27 #include "chrome/installer/util/browser_distribution.h"
27 #include "content/browser/browser_thread.h" 28 #include "content/browser/browser_thread.h"
28 #include "content/browser/renderer_host/backing_store.h" 29 #include "content/browser/renderer_host/backing_store.h"
29 #include "content/browser/renderer_host/render_view_host.h" 30 #include "content/browser/renderer_host/render_view_host.h"
30 #include "content/browser/tab_contents/tab_contents.h" 31 #include "content/browser/tab_contents/tab_contents.h"
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 bool foreground) { 1063 bool foreground) {
1063 if (GetAeroPeekWindow(GetTabID(tab->tab_contents()))) 1064 if (GetAeroPeekWindow(GetTabID(tab->tab_contents())))
1064 return; 1065 return;
1065 1066
1066 AeroPeekWindow* window = 1067 AeroPeekWindow* window =
1067 new AeroPeekWindow(application_window_, 1068 new AeroPeekWindow(application_window_,
1068 this, 1069 this,
1069 GetTabID(tab->tab_contents()), 1070 GetTabID(tab->tab_contents()),
1070 foreground, 1071 foreground,
1071 tab->tab_contents()->GetTitle(), 1072 tab->tab_contents()->GetTitle(),
1072 tab->tab_contents()->GetFavicon()); 1073 tab->favicon_tab_helper()->GetFavicon());
1073 tab_list_.push_back(window); 1074 tab_list_.push_back(window);
1074 } 1075 }
1075 1076
1076 TabContents* AeroPeekManager::GetTabContents(int tab_id) const { 1077 TabContents* AeroPeekManager::GetTabContents(int tab_id) const {
1077 for (TabContentsIterator iterator; !iterator.done(); ++iterator) { 1078 for (TabContentsIterator iterator; !iterator.done(); ++iterator) {
1078 TabContents* target_contents = (*iterator)->tab_contents(); 1079 TabContents* target_contents = (*iterator)->tab_contents();
1079 if (target_contents->controller().session_id().id() == tab_id) 1080 if (target_contents->controller().session_id().id() == tab_id)
1080 return target_contents; 1081 return target_contents;
1081 } 1082 }
1082 return NULL; 1083 return NULL;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 GetAeroPeekWindow(GetTabID(contents->tab_contents())); 1168 GetAeroPeekWindow(GetTabID(contents->tab_contents()));
1168 if (!window) 1169 if (!window)
1169 return; 1170 return;
1170 1171
1171 // Update the title, the favicon, and the thumbnail used for AeroPeek. 1172 // Update the title, the favicon, and the thumbnail used for AeroPeek.
1172 // These function don't actually update the icon and the thumbnail until 1173 // These function don't actually update the icon and the thumbnail until
1173 // Windows needs them (e.g. when a user hovers a taskbar icon) to avoid 1174 // Windows needs them (e.g. when a user hovers a taskbar icon) to avoid
1174 // hurting the rendering performance. (These functions just save the 1175 // hurting the rendering performance. (These functions just save the
1175 // information needed for handling update requests from Windows.) 1176 // information needed for handling update requests from Windows.)
1176 window->SetTitle(contents->tab_contents()->GetTitle()); 1177 window->SetTitle(contents->tab_contents()->GetTitle());
1177 window->SetFavicon(contents->tab_contents()->GetFavicon()); 1178 window->SetFavicon(contents->favicon_tab_helper()->GetFavicon());
1178 window->Update(contents->tab_contents()->is_loading()); 1179 window->Update(contents->tab_contents()->is_loading());
1179 } 1180 }
1180 1181
1181 /////////////////////////////////////////////////////////////////////////////// 1182 ///////////////////////////////////////////////////////////////////////////////
1182 // AeroPeekManager, AeroPeekWindowDelegate implementation: 1183 // AeroPeekManager, AeroPeekWindowDelegate implementation:
1183 1184
1184 void AeroPeekManager::ActivateTab(int tab_id) { 1185 void AeroPeekManager::ActivateTab(int tab_id) {
1185 // Ask TabStrip to activate this tab. 1186 // Ask TabStrip to activate this tab.
1186 // We don't have to update thumbnails now since TabStrip will call 1187 // We don't have to update thumbnails now since TabStrip will call
1187 // TabSelectedAt() when it actually activates this tab. 1188 // TabSelectedAt() when it actually activates this tab.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 // This code is just copied from "thumbnail_generator.cc". 1241 // This code is just copied from "thumbnail_generator.cc".
1241 skia::PlatformCanvas canvas; 1242 skia::PlatformCanvas canvas;
1242 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), 1243 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()),
1243 &canvas)) 1244 &canvas))
1244 return false; 1245 return false;
1245 1246
1246 const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false); 1247 const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false);
1247 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); 1248 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config);
1248 return true; 1249 return true;
1249 } 1250 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_edit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698