| 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 "chrome/browser/devtools/devtools_window.h" | 5 #include "chrome/browser/devtools/devtools_window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 } | 850 } |
| 851 | 851 |
| 852 void DevToolsWindow::WebContentsCreated(WebContents* source_contents, | 852 void DevToolsWindow::WebContentsCreated(WebContents* source_contents, |
| 853 int opener_render_frame_id, | 853 int opener_render_frame_id, |
| 854 const base::string16& frame_name, | 854 const base::string16& frame_name, |
| 855 const GURL& target_url, | 855 const GURL& target_url, |
| 856 WebContents* new_contents) { | 856 WebContents* new_contents) { |
| 857 if (target_url.SchemeIs(content::kChromeDevToolsScheme) && | 857 if (target_url.SchemeIs(content::kChromeDevToolsScheme) && |
| 858 target_url.path().rfind("toolbox.html") != std::string::npos) { | 858 target_url.path().rfind("toolbox.html") != std::string::npos) { |
| 859 CHECK(can_dock_); | 859 CHECK(can_dock_); |
| 860 if (toolbox_web_contents_) |
| 861 delete toolbox_web_contents_; |
| 860 toolbox_web_contents_ = new_contents; | 862 toolbox_web_contents_ = new_contents; |
| 861 } | 863 } |
| 862 } | 864 } |
| 863 | 865 |
| 864 void DevToolsWindow::CloseContents(WebContents* source) { | 866 void DevToolsWindow::CloseContents(WebContents* source) { |
| 865 CHECK(is_docked_); | 867 CHECK(is_docked_); |
| 866 life_stage_ = kClosing; | 868 life_stage_ = kClosing; |
| 867 UpdateBrowserWindow(); | 869 UpdateBrowserWindow(); |
| 868 // In case of docked main_web_contents_, we own it so delete here. | 870 // In case of docked main_web_contents_, we own it so delete here. |
| 869 // Embedding DevTools window will be deleted as a result of | 871 // Embedding DevTools window will be deleted as a result of |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 closure.Run(); | 1203 closure.Run(); |
| 1202 return; | 1204 return; |
| 1203 } | 1205 } |
| 1204 load_completed_callback_ = closure; | 1206 load_completed_callback_ = closure; |
| 1205 } | 1207 } |
| 1206 | 1208 |
| 1207 bool DevToolsWindow::ForwardKeyboardEvent( | 1209 bool DevToolsWindow::ForwardKeyboardEvent( |
| 1208 const content::NativeWebKeyboardEvent& event) { | 1210 const content::NativeWebKeyboardEvent& event) { |
| 1209 return event_forwarder_->ForwardEvent(event); | 1211 return event_forwarder_->ForwardEvent(event); |
| 1210 } | 1212 } |
| OLD | NEW |