| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/win_util.h" | 5 #include "app/win_util.h" |
| 6 | 6 |
| 7 #include <commdlg.h> | 7 #include <commdlg.h> |
| 8 #include <dwmapi.h> | 8 #include <dwmapi.h> |
| 9 #include <propvarutil.h> | 9 #include <propvarutil.h> |
| 10 #include <shellapi.h> | 10 #include <shellapi.h> |
| 11 #include <shlobj.h> | 11 #include <shlobj.h> |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "app/gfx/codec/png_codec.h" |
| 15 #include "app/l10n_util.h" | 16 #include "app/l10n_util.h" |
| 16 #include "app/l10n_util_win.h" | 17 #include "app/l10n_util_win.h" |
| 17 #include "base/base_switches.h" | 18 #include "base/base_switches.h" |
| 18 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 19 #include "base/file_util.h" | 20 #include "base/file_util.h" |
| 20 #include "base/gfx/gdi_util.h" | 21 #include "base/gfx/gdi_util.h" |
| 21 #include "base/gfx/png_encoder.h" | |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/native_library.h" | 23 #include "base/native_library.h" |
| 24 #include "base/registry.h" | 24 #include "base/registry.h" |
| 25 #include "base/scoped_comptr_win.h" | 25 #include "base/scoped_comptr_win.h" |
| 26 #include "base/scoped_handle.h" | 26 #include "base/scoped_handle.h" |
| 27 #include "base/scoped_handle_win.h" | 27 #include "base/scoped_handle_win.h" |
| 28 #include "base/string_util.h" | 28 #include "base/string_util.h" |
| 29 #include "base/win_util.h" | 29 #include "base/win_util.h" |
| 30 #include "grit/app_strings.h" | 30 #include "grit/app_strings.h" |
| 31 #include "net/base/mime_util.h" | 31 #include "net/base/mime_util.h" |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 // than nothing and will work fine in the average case (window is | 738 // than nothing and will work fine in the average case (window is |
| 739 // completely on screen). | 739 // completely on screen). |
| 740 if (print_window) | 740 if (print_window) |
| 741 (*print_window)(window_handle, mem_hdc, 0); | 741 (*print_window)(window_handle, mem_hdc, 0); |
| 742 else | 742 else |
| 743 BitBlt(mem_hdc, 0, 0, width, height, window_hdc, 0, 0, SRCCOPY); | 743 BitBlt(mem_hdc, 0, 0, width, height, window_hdc, 0, 0, SRCCOPY); |
| 744 | 744 |
| 745 // We now have a copy of the window contents in a DIB, so | 745 // We now have a copy of the window contents in a DIB, so |
| 746 // encode it into a useful format for posting to the bug report | 746 // encode it into a useful format for posting to the bug report |
| 747 // server. | 747 // server. |
| 748 PNGEncoder::Encode(bit_ptr, PNGEncoder::FORMAT_BGRA, | 748 gfx::PNGCodec::Encode(bit_ptr, gfx::PNGCodec::FORMAT_BGRA, |
| 749 width, height, width * 4, true, | 749 width, height, width * 4, true, |
| 750 png_representation); | 750 png_representation); |
| 751 | 751 |
| 752 ReleaseDC(window_handle, window_hdc); | 752 ReleaseDC(window_handle, window_hdc); |
| 753 } | 753 } |
| 754 | 754 |
| 755 bool IsWindowActive(HWND hwnd) { | 755 bool IsWindowActive(HWND hwnd) { |
| 756 WINDOWINFO info; | 756 WINDOWINFO info; |
| 757 return ::GetWindowInfo(hwnd, &info) && | 757 return ::GetWindowInfo(hwnd, &info) && |
| 758 ((info.dwWindowStatus & WS_ACTIVECAPTION) != 0); | 758 ((info.dwWindowStatus & WS_ACTIVECAPTION) != 0); |
| 759 } | 759 } |
| 760 | 760 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 if (S_OK == pps->SetValue(PKEY_AppUserModel_ID, pv)) | 890 if (S_OK == pps->SetValue(PKEY_AppUserModel_ID, pv)) |
| 891 pps->Commit(); | 891 pps->Commit(); |
| 892 } | 892 } |
| 893 | 893 |
| 894 // Cleanup. | 894 // Cleanup. |
| 895 PropVariantClear(&pv); | 895 PropVariantClear(&pv); |
| 896 base::UnloadNativeLibrary(shell32_library); | 896 base::UnloadNativeLibrary(shell32_library); |
| 897 } | 897 } |
| 898 | 898 |
| 899 } // namespace win_util | 899 } // namespace win_util |
| OLD | NEW |