| OLD | NEW |
| 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" | |
| 14 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/win/scoped_comptr.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_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 20 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 21 #include "chrome/browser/tabs/tab_strip_model.h" | 21 #include "chrome/browser/tabs/tab_strip_model.h" |
| 22 #include "chrome/browser/ui/browser_list.h" | 22 #include "chrome/browser/ui/browser_list.h" |
| 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 BrowserDistribution::GetDistribution()->GetBrowserAppId(), window_); | 256 BrowserDistribution::GetDistribution()->GetBrowserAppId(), window_); |
| 257 | 257 |
| 258 // Register this place-holder window to the taskbar as a child of | 258 // Register this place-holder window to the taskbar as a child of |
| 259 // the browser window and add it to the end of its tab list. | 259 // the browser window and add it to the end of its tab list. |
| 260 // Correctly, this registration should be called after this browser window | 260 // Correctly, this registration should be called after this browser window |
| 261 // receives a registered window message "TaskbarButtonCreated", which | 261 // receives a registered window message "TaskbarButtonCreated", which |
| 262 // means that Windows creates a taskbar button for this window in its | 262 // means that Windows creates a taskbar button for this window in its |
| 263 // taskbar. But it seems to be OK to register it without checking the | 263 // taskbar. But it seems to be OK to register it without checking the |
| 264 // message. | 264 // message. |
| 265 // TODO(hbono): we need to check this registered message? | 265 // TODO(hbono): we need to check this registered message? |
| 266 ScopedComPtr<ITaskbarList3> taskbar; | 266 base::win::ScopedComPtr<ITaskbarList3> taskbar; |
| 267 if (FAILED(taskbar.CreateInstance(CLSID_TaskbarList, NULL, | 267 if (FAILED(taskbar.CreateInstance(CLSID_TaskbarList, NULL, |
| 268 CLSCTX_INPROC_SERVER)) || | 268 CLSCTX_INPROC_SERVER)) || |
| 269 FAILED(taskbar->HrInit()) || | 269 FAILED(taskbar->HrInit()) || |
| 270 FAILED(taskbar->RegisterTab(window_, frame_window_)) || | 270 FAILED(taskbar->RegisterTab(window_, frame_window_)) || |
| 271 FAILED(taskbar->SetTabOrder(window_, NULL))) | 271 FAILED(taskbar->SetTabOrder(window_, NULL))) |
| 272 return; | 272 return; |
| 273 if (active_) | 273 if (active_) |
| 274 taskbar->SetTabActive(window_, frame_window_, 0); | 274 taskbar->SetTabActive(window_, frame_window_, 0); |
| 275 } | 275 } |
| 276 | 276 |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 tab_active_ = true; | 724 tab_active_ = true; |
| 725 | 725 |
| 726 // Create a place-holder window and add it to the tab list if it has not been | 726 // Create a place-holder window and add it to the tab list if it has not been |
| 727 // created yet. (This case happens when we re-attached a detached window.) | 727 // created yet. (This case happens when we re-attached a detached window.) |
| 728 if (!IsWindow(hwnd())) { | 728 if (!IsWindow(hwnd())) { |
| 729 Update(false); | 729 Update(false); |
| 730 return; | 730 return; |
| 731 } | 731 } |
| 732 | 732 |
| 733 // Notify Windows to set the thumbnail focus to this window. | 733 // Notify Windows to set the thumbnail focus to this window. |
| 734 ScopedComPtr<ITaskbarList3> taskbar; | 734 base::win::ScopedComPtr<ITaskbarList3> taskbar; |
| 735 HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL, | 735 HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL, |
| 736 CLSCTX_INPROC_SERVER); | 736 CLSCTX_INPROC_SERVER); |
| 737 if (FAILED(result)) { | 737 if (FAILED(result)) { |
| 738 LOG(ERROR) << "failed creating an ITaskbarList3 interface."; | 738 LOG(ERROR) << "failed creating an ITaskbarList3 interface."; |
| 739 return; | 739 return; |
| 740 } | 740 } |
| 741 | 741 |
| 742 result = taskbar->HrInit(); | 742 result = taskbar->HrInit(); |
| 743 if (FAILED(result)) { | 743 if (FAILED(result)) { |
| 744 LOG(ERROR) << "failed initializing an ITaskbarList3 interface."; | 744 LOG(ERROR) << "failed initializing an ITaskbarList3 interface."; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 // we don't have enough information to create a thumbnail. | 778 // we don't have enough information to create a thumbnail. |
| 779 if (tab_active_ || !is_loading) | 779 if (tab_active_ || !is_loading) |
| 780 UpdateThumbnail(); | 780 UpdateThumbnail(); |
| 781 } | 781 } |
| 782 | 782 |
| 783 void AeroPeekWindow::Destroy() { | 783 void AeroPeekWindow::Destroy() { |
| 784 if (!IsWindow(hwnd())) | 784 if (!IsWindow(hwnd())) |
| 785 return; | 785 return; |
| 786 | 786 |
| 787 // Remove this window from the tab list of Windows. | 787 // Remove this window from the tab list of Windows. |
| 788 ScopedComPtr<ITaskbarList3> taskbar; | 788 base::win::ScopedComPtr<ITaskbarList3> taskbar; |
| 789 HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL, | 789 HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL, |
| 790 CLSCTX_INPROC_SERVER); | 790 CLSCTX_INPROC_SERVER); |
| 791 if (FAILED(result)) | 791 if (FAILED(result)) |
| 792 return; | 792 return; |
| 793 | 793 |
| 794 result = taskbar->HrInit(); | 794 result = taskbar->HrInit(); |
| 795 if (FAILED(result)) | 795 if (FAILED(result)) |
| 796 return; | 796 return; |
| 797 | 797 |
| 798 result = taskbar->UnregisterTab(hwnd()); | 798 result = taskbar->UnregisterTab(hwnd()); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 // This code is just copied from "thumbnail_generator.cc". | 1240 // This code is just copied from "thumbnail_generator.cc". |
| 1241 skia::PlatformCanvas canvas; | 1241 skia::PlatformCanvas canvas; |
| 1242 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), | 1242 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), |
| 1243 &canvas)) | 1243 &canvas)) |
| 1244 return false; | 1244 return false; |
| 1245 | 1245 |
| 1246 const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false); | 1246 const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false); |
| 1247 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); | 1247 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); |
| 1248 return true; | 1248 return true; |
| 1249 } | 1249 } |
| OLD | NEW |