OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_util.h" | 10 #include "app/win_util.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/scoped_comptr_win.h" | 12 #include "base/scoped_comptr_win.h" |
13 #include "base/scoped_handle_win.h" | 13 #include "base/scoped_handle_win.h" |
14 #include "base/scoped_native_library.h" | 14 #include "base/scoped_native_library.h" |
15 #include "base/waitable_event.h" | 15 #include "base/waitable_event.h" |
16 #include "base/win_util.h" | 16 #include "base/win/windows_version.h" |
17 #include "chrome/browser/app_icon_win.h" | 17 #include "chrome/browser/app_icon_win.h" |
18 #include "chrome/browser/browser_list.h" | 18 #include "chrome/browser/browser_list.h" |
19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/browser_thread.h" | 20 #include "chrome/browser/browser_thread.h" |
21 #include "chrome/browser/renderer_host/backing_store.h" | 21 #include "chrome/browser/renderer_host/backing_store.h" |
22 #include "chrome/browser/renderer_host/render_view_host.h" | 22 #include "chrome/browser/renderer_host/render_view_host.h" |
23 #include "chrome/browser/tab_contents/tab_contents.h" | 23 #include "chrome/browser/tab_contents/tab_contents.h" |
24 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 24 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
25 #include "chrome/browser/tab_contents/tab_contents_view.h" | 25 #include "chrome/browser/tab_contents/tab_contents_view.h" |
26 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 26 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 | 1022 |
1023 // static | 1023 // static |
1024 bool AeroPeekManager::Enabled() { | 1024 bool AeroPeekManager::Enabled() { |
1025 // We enable our custom AeroPeek only when: | 1025 // We enable our custom AeroPeek only when: |
1026 // * Chrome is running on Windows 7 and Aero is enabled, | 1026 // * Chrome is running on Windows 7 and Aero is enabled, |
1027 // * Chrome is not launched in application mode, and | 1027 // * Chrome is not launched in application mode, and |
1028 // * Chrome is launched with the "--enable-aero-peek-tabs" option. | 1028 // * Chrome is launched with the "--enable-aero-peek-tabs" option. |
1029 // TODO(hbono): Bug 37957 <http://crbug.com/37957>: find solutions that avoid | 1029 // TODO(hbono): Bug 37957 <http://crbug.com/37957>: find solutions that avoid |
1030 // flooding users with tab thumbnails. | 1030 // flooding users with tab thumbnails. |
1031 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1031 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1032 return win_util::GetWinVersion() >= win_util::WINVERSION_WIN7 && | 1032 return base::win::GetVersion() >= base::win::VERSION_WIN7 && |
1033 win_util::ShouldUseVistaFrame() && | 1033 win_util::ShouldUseVistaFrame() && |
1034 !command_line->HasSwitch(switches::kApp) && | 1034 !command_line->HasSwitch(switches::kApp) && |
1035 command_line->HasSwitch(switches::kEnableAeroPeekTabs); | 1035 command_line->HasSwitch(switches::kEnableAeroPeekTabs); |
1036 } | 1036 } |
1037 | 1037 |
1038 void AeroPeekManager::DeleteAeroPeekWindow(int tab_id) { | 1038 void AeroPeekManager::DeleteAeroPeekWindow(int tab_id) { |
1039 // This function does NOT call AeroPeekWindow::Destroy() before deleting | 1039 // This function does NOT call AeroPeekWindow::Destroy() before deleting |
1040 // the AeroPeekWindow instance. | 1040 // the AeroPeekWindow instance. |
1041 for (std::list<AeroPeekWindow*>::iterator i = tab_list_.begin(); | 1041 for (std::list<AeroPeekWindow*>::iterator i = tab_list_.begin(); |
1042 i != tab_list_.end(); ++i) { | 1042 i != tab_list_.end(); ++i) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 // This code is just copied from "thumbnail_generator.cc". | 1223 // This code is just copied from "thumbnail_generator.cc". |
1224 skia::PlatformCanvas canvas; | 1224 skia::PlatformCanvas canvas; |
1225 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), | 1225 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), |
1226 &canvas)) | 1226 &canvas)) |
1227 return false; | 1227 return false; |
1228 | 1228 |
1229 const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false); | 1229 const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
1230 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); | 1230 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); |
1231 return true; | 1231 return true; |
1232 } | 1232 } |
OLD | NEW |