| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <commctrl.h> | 8 #include <commctrl.h> |
| 9 | 9 |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/win/resource_util.h" | 12 #include "base/win/resource_util.h" |
| 13 #include "base/win/wrapped_window_proc.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
| 15 #include "content/shell/resource.h" | 16 #include "content/shell/resource.h" |
| 16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 17 #include "grit/webkit_resources.h" | 18 #include "grit/webkit_resources.h" |
| 18 #include "grit/webkit_chromium_resources.h" | 19 #include "grit/webkit_chromium_resources.h" |
| 19 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
| 20 #include "net/base/net_module.h" | 21 #include "net/base/net_module.h" |
| 21 #include "ui/base/win/hwnd_util.h" | 22 #include "ui/base/win/hwnd_util.h" |
| 22 | 23 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 39 : base::StringPiece(); | 40 : base::StringPiece(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 } // namespace | 43 } // namespace |
| 43 | 44 |
| 44 namespace content { | 45 namespace content { |
| 45 | 46 |
| 46 HINSTANCE Shell::instance_handle_; | 47 HINSTANCE Shell::instance_handle_; |
| 47 | 48 |
| 48 void Shell::PlatformInitialize() { | 49 void Shell::PlatformInitialize() { |
| 49 instance_handle_ = ::GetModuleHandle(NULL); | |
| 50 | |
| 51 INITCOMMONCONTROLSEX InitCtrlEx; | 50 INITCOMMONCONTROLSEX InitCtrlEx; |
| 52 InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); | 51 InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); |
| 53 InitCtrlEx.dwICC = ICC_STANDARD_CLASSES; | 52 InitCtrlEx.dwICC = ICC_STANDARD_CLASSES; |
| 54 InitCommonControlsEx(&InitCtrlEx); | 53 InitCommonControlsEx(&InitCtrlEx); |
| 55 RegisterWindowClass(); | 54 RegisterWindowClass(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 base::StringPiece Shell::PlatformResourceProvider(int key) { | 57 base::StringPiece Shell::PlatformResourceProvider(int key) { |
| 59 return GetRawDataResource(::GetModuleHandle(NULL), key); | 58 return GetRawDataResource(::GetModuleHandle(NULL), key); |
| 60 } | 59 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 182 |
| 184 MoveWindow(GetContentView(), 0, kURLBarHeight, rc.right, | 183 MoveWindow(GetContentView(), 0, kURLBarHeight, rc.right, |
| 185 rc.bottom - kURLBarHeight, TRUE); | 184 rc.bottom - kURLBarHeight, TRUE); |
| 186 } | 185 } |
| 187 | 186 |
| 188 void Shell::Close() { | 187 void Shell::Close() { |
| 189 DestroyWindow(window_); | 188 DestroyWindow(window_); |
| 190 } | 189 } |
| 191 | 190 |
| 192 ATOM Shell::RegisterWindowClass() { | 191 ATOM Shell::RegisterWindowClass() { |
| 193 WNDCLASSEX wcex = { | 192 WNDCLASSEXW window_class; |
| 194 sizeof(WNDCLASSEX), | 193 base::win::InitializeWindowClass( |
| 194 kWindowClass, |
| 195 &Shell::WndProc, |
| 195 CS_HREDRAW | CS_VREDRAW, | 196 CS_HREDRAW | CS_VREDRAW, |
| 196 Shell::WndProc, | |
| 197 0, | 197 0, |
| 198 0, | 198 0, |
| 199 instance_handle_, | 199 LoadCursor(NULL, IDC_ARROW), |
| 200 NULL, | 200 NULL, |
| 201 LoadCursor(NULL, IDC_ARROW), | |
| 202 0, | |
| 203 MAKEINTRESOURCE(IDC_CONTENTSHELL), | 201 MAKEINTRESOURCE(IDC_CONTENTSHELL), |
| 204 kWindowClass, | |
| 205 NULL, | 202 NULL, |
| 206 }; | 203 NULL, |
| 207 return RegisterClassEx(&wcex); | 204 &window_class); |
| 205 instance_handle_ = window_class.hInstance; |
| 206 return RegisterClassEx(&window_class); |
| 208 } | 207 } |
| 209 | 208 |
| 210 LRESULT CALLBACK Shell::WndProc(HWND hwnd, UINT message, WPARAM wParam, | 209 LRESULT CALLBACK Shell::WndProc(HWND hwnd, UINT message, WPARAM wParam, |
| 211 LPARAM lParam) { | 210 LPARAM lParam) { |
| 212 Shell* shell = static_cast<Shell*>(ui::GetWindowUserData(hwnd)); | 211 Shell* shell = static_cast<Shell*>(ui::GetWindowUserData(hwnd)); |
| 213 | 212 |
| 214 switch (message) { | 213 switch (message) { |
| 215 case WM_COMMAND: { | 214 case WM_COMMAND: { |
| 216 int id = LOWORD(wParam); | 215 int id = LOWORD(wParam); |
| 217 switch (id) { | 216 switch (id) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 275 |
| 277 return 0; | 276 return 0; |
| 278 } | 277 } |
| 279 } | 278 } |
| 280 | 279 |
| 281 return CallWindowProc(shell->default_edit_wnd_proc_, hwnd, message, wParam, | 280 return CallWindowProc(shell->default_edit_wnd_proc_, hwnd, message, wParam, |
| 282 lParam); | 281 lParam); |
| 283 } | 282 } |
| 284 | 283 |
| 285 } // namespace content | 284 } // namespace content |
| OLD | NEW |