| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/win/resource_util.h" | 13 #include "base/win/resource_util.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
| 16 #include "content/shell/resource.h" | 16 #include "content/shell/resource.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "grit/webkit_resources.h" | 18 #include "grit/webkit_resources.h" |
| 19 #include "grit/webkit_chromium_resources.h" | 19 #include "grit/webkit_chromium_resources.h" |
| 20 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
| 21 #include "net/base/net_module.h" | 21 #include "net/base/net_module.h" |
| 22 #include "ui/base/win/hwnd_util.h" | 22 #include "ui/base/win/hwnd_util.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 default_edit_wnd_proc_ = ui::SetWindowProc(url_edit_view_, | 141 default_edit_wnd_proc_ = ui::SetWindowProc(url_edit_view_, |
| 142 Shell::EditWndProc); | 142 Shell::EditWndProc); |
| 143 ui::SetWindowUserData(url_edit_view_, this); | 143 ui::SetWindowUserData(url_edit_view_, this); |
| 144 | 144 |
| 145 ShowWindow(window_, SW_SHOW); | 145 ShowWindow(window_, SW_SHOW); |
| 146 | 146 |
| 147 SizeTo(width, height); | 147 SizeTo(width, height); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void Shell::PlatformSetContents() { | 150 void Shell::PlatformSetContents() { |
| 151 SetParent(tab_contents_->GetView()->GetNativeView(), window_); | 151 SetParent(web_contents_->GetView()->GetNativeView(), window_); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void Shell::SizeTo(int width, int height) { | 154 void Shell::SizeTo(int width, int height) { |
| 155 RECT rc, rw; | 155 RECT rc, rw; |
| 156 GetClientRect(window_, &rc); | 156 GetClientRect(window_, &rc); |
| 157 GetWindowRect(window_, &rw); | 157 GetWindowRect(window_, &rw); |
| 158 | 158 |
| 159 int client_width = rc.right - rc.left; | 159 int client_width = rc.right - rc.left; |
| 160 int window_width = rw.right - rw.left; | 160 int window_width = rw.right - rw.left; |
| 161 window_width = (window_width - client_width) + width; | 161 window_width = (window_width - client_width) + width; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 LRESULT CALLBACK Shell::WndProc(HWND hwnd, UINT message, WPARAM wParam, | 203 LRESULT CALLBACK Shell::WndProc(HWND hwnd, UINT message, WPARAM wParam, |
| 204 LPARAM lParam) { | 204 LPARAM lParam) { |
| 205 Shell* shell = static_cast<Shell*>(ui::GetWindowUserData(hwnd)); | 205 Shell* shell = static_cast<Shell*>(ui::GetWindowUserData(hwnd)); |
| 206 | 206 |
| 207 switch (message) { | 207 switch (message) { |
| 208 case WM_COMMAND: { | 208 case WM_COMMAND: { |
| 209 int id = LOWORD(wParam); | 209 int id = LOWORD(wParam); |
| 210 switch (id) { | 210 switch (id) { |
| 211 case IDM_NEW_WINDOW: | 211 case IDM_NEW_WINDOW: |
| 212 CreateNewWindow( | 212 CreateNewWindow( |
| 213 shell->tab_contents()->GetBrowserContext(), | 213 shell->web_contents()->GetBrowserContext(), |
| 214 GURL(), NULL, MSG_ROUTING_NONE, NULL); | 214 GURL(), NULL, MSG_ROUTING_NONE, NULL); |
| 215 break; | 215 break; |
| 216 case IDM_CLOSE_WINDOW: | 216 case IDM_CLOSE_WINDOW: |
| 217 DestroyWindow(hwnd); | 217 DestroyWindow(hwnd); |
| 218 break; | 218 break; |
| 219 case IDM_EXIT: | 219 case IDM_EXIT: |
| 220 PlatformExit(); | 220 PlatformExit(); |
| 221 break; | 221 break; |
| 222 case IDC_NAV_BACK: | 222 case IDC_NAV_BACK: |
| 223 shell->GoBackOrForward(-1); | 223 shell->GoBackOrForward(-1); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 return 0; | 272 return 0; |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 return CallWindowProc(shell->default_edit_wnd_proc_, hwnd, message, wParam, | 276 return CallWindowProc(shell->default_edit_wnd_proc_, hwnd, message, wParam, |
| 277 lParam); | 277 lParam); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace content | 280 } // namespace content |
| OLD | NEW |