| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ui_bindings.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 class DevToolsUIBindings::FrontendWebContentsObserver | 294 class DevToolsUIBindings::FrontendWebContentsObserver |
| 295 : public content::WebContentsObserver { | 295 : public content::WebContentsObserver { |
| 296 public: | 296 public: |
| 297 explicit FrontendWebContentsObserver(DevToolsUIBindings* ui_bindings); | 297 explicit FrontendWebContentsObserver(DevToolsUIBindings* ui_bindings); |
| 298 ~FrontendWebContentsObserver() override; | 298 ~FrontendWebContentsObserver() override; |
| 299 | 299 |
| 300 private: | 300 private: |
| 301 // contents::WebContentsObserver: | 301 // contents::WebContentsObserver: |
| 302 void RenderProcessGone(base::TerminationStatus status) override; | 302 void RenderProcessGone(base::TerminationStatus status) override; |
| 303 void DidStartProvisionalLoadForFrame( | 303 // TODO(creis): Replace with RenderFrameCreated when http://crbug.com/425397 |
| 304 content::RenderFrameHost* render_frame_host, | 304 // is fixed. See also http://crbug.com/424641. |
| 305 const GURL& validated_url, | 305 void AboutToNavigateRenderFrame( |
| 306 bool is_error_page, | 306 content::RenderFrameHost* old_host, |
| 307 bool is_iframe_srcdoc) override; | 307 content::RenderFrameHost* new_host) override; |
| 308 void DocumentOnLoadCompletedInMainFrame() override; | 308 void DocumentOnLoadCompletedInMainFrame() override; |
| 309 void DidNavigateMainFrame( | 309 void DidNavigateMainFrame( |
| 310 const content::LoadCommittedDetails& details, | 310 const content::LoadCommittedDetails& details, |
| 311 const content::FrameNavigateParams& params) override; | 311 const content::FrameNavigateParams& params) override; |
| 312 | 312 |
| 313 DevToolsUIBindings* devtools_bindings_; | 313 DevToolsUIBindings* devtools_bindings_; |
| 314 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); | 314 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); |
| 315 }; | 315 }; |
| 316 | 316 |
| 317 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( | 317 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 339 devtools_bindings_->Detach(); | 339 devtools_bindings_->Detach(); |
| 340 break; | 340 break; |
| 341 default: | 341 default: |
| 342 crashed = false; | 342 crashed = false; |
| 343 break; | 343 break; |
| 344 } | 344 } |
| 345 devtools_bindings_->delegate_->RenderProcessGone(crashed); | 345 devtools_bindings_->delegate_->RenderProcessGone(crashed); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void DevToolsUIBindings::FrontendWebContentsObserver:: | 348 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 349 DidStartProvisionalLoadForFrame(content::RenderFrameHost* render_frame_host, | 349 AboutToNavigateRenderFrame(content::RenderFrameHost* old_host, |
| 350 const GURL& validated_url, | 350 content::RenderFrameHost* new_host) { |
| 351 bool is_error_page, | 351 if (new_host->GetParent()) |
| 352 bool is_iframe_srcdoc) { | |
| 353 if (render_frame_host->GetParent()) | |
| 354 return; | 352 return; |
| 355 devtools_bindings_->frontend_host_.reset( | 353 devtools_bindings_->frontend_host_.reset( |
| 356 content::DevToolsFrontendHost::Create(render_frame_host, | 354 content::DevToolsFrontendHost::Create(new_host, |
| 357 devtools_bindings_)); | 355 devtools_bindings_)); |
| 358 } | 356 } |
| 359 | 357 |
| 360 void DevToolsUIBindings::FrontendWebContentsObserver:: | 358 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 361 DocumentOnLoadCompletedInMainFrame() { | 359 DocumentOnLoadCompletedInMainFrame() { |
| 362 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); | 360 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); |
| 363 } | 361 } |
| 364 | 362 |
| 365 void DevToolsUIBindings::FrontendWebContentsObserver:: | 363 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 366 DidNavigateMainFrame(const content::LoadCommittedDetails& details, | 364 DidNavigateMainFrame(const content::LoadCommittedDetails& details, |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 void DevToolsUIBindings::FrontendLoaded() { | 1143 void DevToolsUIBindings::FrontendLoaded() { |
| 1146 if (frontend_loaded_) | 1144 if (frontend_loaded_) |
| 1147 return; | 1145 return; |
| 1148 frontend_loaded_ = true; | 1146 frontend_loaded_ = true; |
| 1149 | 1147 |
| 1150 // Call delegate first - it seeds importants bit of information. | 1148 // Call delegate first - it seeds importants bit of information. |
| 1151 delegate_->OnLoadCompleted(); | 1149 delegate_->OnLoadCompleted(); |
| 1152 | 1150 |
| 1153 AddDevToolsExtensionsToClient(); | 1151 AddDevToolsExtensionsToClient(); |
| 1154 } | 1152 } |
| OLD | NEW |