| 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/gfx/gdi_util.h" | 10 #include "app/gfx/gdi_util.h" |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 } | 1011 } |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 void AeroPeekManager::SetContentInsets(const gfx::Insets& insets) { | 1014 void AeroPeekManager::SetContentInsets(const gfx::Insets& insets) { |
| 1015 content_insets_ = insets; | 1015 content_insets_ = insets; |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 // static | 1018 // static |
| 1019 bool AeroPeekManager::Enabled() { | 1019 bool AeroPeekManager::Enabled() { |
| 1020 // We enable our custom AeroPeek only when: | 1020 // We enable our custom AeroPeek only when: |
| 1021 // * Chrome is running on Windows 7, and | 1021 // * Chrome is running on Windows 7, |
| 1022 // * Chrome is not lauched in the application mode. | 1022 // * Chrome is not lauched in the application mode, and |
| 1023 return win_util::GetWinVersion() >= win_util::WINVERSION_WIN7 && | 1023 // * Aero is enabled. |
| 1024 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kApp); | 1024 if (win_util::GetWinVersion() < win_util::WINVERSION_WIN7 || |
| 1025 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAeroPeek) || |
| 1026 CommandLine::ForCurrentProcess()->HasSwitch(switches::kApp)) |
| 1027 return false; |
| 1028 |
| 1029 return win_util::ShouldUseVistaFrame(); |
| 1025 } | 1030 } |
| 1026 | 1031 |
| 1027 void AeroPeekManager::DeleteAeroPeekWindow(int tab_id) { | 1032 void AeroPeekManager::DeleteAeroPeekWindow(int tab_id) { |
| 1028 // This function does NOT call AeroPeekWindow::Destroy() before deleting | 1033 // This function does NOT call AeroPeekWindow::Destroy() before deleting |
| 1029 // the AeroPeekWindow instance. | 1034 // the AeroPeekWindow instance. |
| 1030 for (std::list<AeroPeekWindow*>::iterator i = tab_list_.begin(); | 1035 for (std::list<AeroPeekWindow*>::iterator i = tab_list_.begin(); |
| 1031 i != tab_list_.end(); ++i) { | 1036 i != tab_list_.end(); ++i) { |
| 1032 AeroPeekWindow* window = *i; | 1037 AeroPeekWindow* window = *i; |
| 1033 if (window->tab_id() == tab_id) { | 1038 if (window->tab_id() == tab_id) { |
| 1034 tab_list_.erase(i); | 1039 tab_list_.erase(i); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 skia::PlatformCanvas canvas; | 1218 skia::PlatformCanvas canvas; |
| 1214 if (!backing_store->CopyFromBackingStore(gfx::Rect(gfx::Point(0, 0), | 1219 if (!backing_store->CopyFromBackingStore(gfx::Rect(gfx::Point(0, 0), |
| 1215 backing_store->size()), | 1220 backing_store->size()), |
| 1216 &canvas)) | 1221 &canvas)) |
| 1217 return false; | 1222 return false; |
| 1218 | 1223 |
| 1219 const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false); | 1224 const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
| 1220 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); | 1225 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); |
| 1221 return true; | 1226 return true; |
| 1222 } | 1227 } |
| OLD | NEW |