OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tab_contents/web_contents_view_win.h" | 5 #include "chrome/browser/tab_contents/web_contents_view_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
10 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 10 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/debugger/dev_tools_window.h" |
12 #include "chrome/browser/download/download_request_manager.h" | 13 #include "chrome/browser/download/download_request_manager.h" |
13 #include "chrome/browser/renderer_host/render_process_host.h" | 14 #include "chrome/browser/renderer_host/render_process_host.h" |
14 #include "chrome/browser/renderer_host/render_view_host.h" | 15 #include "chrome/browser/renderer_host/render_view_host.h" |
15 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 16 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
16 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 17 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
17 #include "chrome/browser/tab_contents/render_view_context_menu_controller.h" | 18 #include "chrome/browser/tab_contents/render_view_context_menu_controller.h" |
18 #include "chrome/browser/tab_contents/interstitial_page.h" | 19 #include "chrome/browser/tab_contents/interstitial_page.h" |
19 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 20 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
20 #include "chrome/browser/tab_contents/web_contents.h" | 21 #include "chrome/browser/tab_contents/web_contents.h" |
21 #include "chrome/browser/tab_contents/web_drag_source.h" | 22 #include "chrome/browser/tab_contents/web_drag_source.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // Note that it's possible to get this message after the window was destroyed. | 206 // Note that it's possible to get this message after the window was destroyed. |
206 if (::IsWindow(GetNativeView())) | 207 if (::IsWindow(GetNativeView())) |
207 InvalidateRect(GetNativeView(), NULL, FALSE); | 208 InvalidateRect(GetNativeView(), NULL, FALSE); |
208 } | 209 } |
209 | 210 |
210 void WebContentsViewWin::SizeContents(const gfx::Size& size) { | 211 void WebContentsViewWin::SizeContents(const gfx::Size& size) { |
211 // TODO(brettw) this is a hack and should be removed. See web_contents_view.h. | 212 // TODO(brettw) this is a hack and should be removed. See web_contents_view.h. |
212 WasSized(size); | 213 WasSized(size); |
213 } | 214 } |
214 | 215 |
| 216 void WebContentsViewWin::OpenDeveloperTools() { |
| 217 if (!dev_tools_window_.get()) |
| 218 dev_tools_window_.reset(new DevToolsWindow); |
| 219 |
| 220 RenderViewHost* host = web_contents_->render_view_host(); |
| 221 if (!host) |
| 222 return; |
| 223 |
| 224 dev_tools_window_->Show(host->process()->host_id(), host->routing_id()); |
| 225 } |
| 226 |
| 227 void WebContentsViewWin::ForwardMessageToDevToolsClient( |
| 228 const IPC::Message& message) { |
| 229 if (!dev_tools_window_.get()) { |
| 230 NOTREACHED() << "Developer tools window is not open."; |
| 231 return; |
| 232 } |
| 233 dev_tools_window_->SendDevToolsClientMessage(message); |
| 234 } |
| 235 |
215 void WebContentsViewWin::UpdateDragCursor(bool is_drop_target) { | 236 void WebContentsViewWin::UpdateDragCursor(bool is_drop_target) { |
216 drop_target_->set_is_drop_target(is_drop_target); | 237 drop_target_->set_is_drop_target(is_drop_target); |
217 } | 238 } |
218 | 239 |
219 void WebContentsViewWin::TakeFocus(bool reverse) { | 240 void WebContentsViewWin::TakeFocus(bool reverse) { |
220 views::FocusManager* focus_manager = | 241 views::FocusManager* focus_manager = |
221 views::FocusManager::GetFocusManager(GetNativeView()); | 242 views::FocusManager::GetFocusManager(GetNativeView()); |
222 | 243 |
223 // We may not have a focus manager if the tab has been switched before this | 244 // We may not have a focus manager if the tab has been switched before this |
224 // message arrived. | 245 // message arrived. |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 } | 622 } |
602 return false; | 623 return false; |
603 } | 624 } |
604 | 625 |
605 void WebContentsViewWin::WheelZoom(int distance) { | 626 void WebContentsViewWin::WheelZoom(int distance) { |
606 if (web_contents_->delegate()) { | 627 if (web_contents_->delegate()) { |
607 bool zoom_in = distance > 0; | 628 bool zoom_in = distance > 0; |
608 web_contents_->delegate()->ContentsZoomChange(zoom_in); | 629 web_contents_->delegate()->ContentsZoomChange(zoom_in); |
609 } | 630 } |
610 } | 631 } |
OLD | NEW |