| 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 // TODO(creis): Replace with RenderFrameCreated when http://crbug.com/425397 | 303 void DidStartNavigationToPendingEntry( |
| 304 // is fixed. See also http://crbug.com/424641. | 304 const GURL& url, |
| 305 void AboutToNavigateRenderFrame( | 305 content::NavigationController::ReloadType reload_type) override; |
| 306 content::RenderFrameHost* old_host, | |
| 307 content::RenderFrameHost* new_host) override; | |
| 308 void DocumentOnLoadCompletedInMainFrame() override; | 306 void DocumentOnLoadCompletedInMainFrame() override; |
| 309 void DidNavigateMainFrame( | 307 void DidNavigateMainFrame( |
| 310 const content::LoadCommittedDetails& details, | 308 const content::LoadCommittedDetails& details, |
| 311 const content::FrameNavigateParams& params) override; | 309 const content::FrameNavigateParams& params) override; |
| 312 | 310 |
| 313 DevToolsUIBindings* devtools_bindings_; | 311 DevToolsUIBindings* devtools_bindings_; |
| 314 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); | 312 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); |
| 315 }; | 313 }; |
| 316 | 314 |
| 317 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( | 315 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 339 devtools_bindings_->Detach(); | 337 devtools_bindings_->Detach(); |
| 340 break; | 338 break; |
| 341 default: | 339 default: |
| 342 crashed = false; | 340 crashed = false; |
| 343 break; | 341 break; |
| 344 } | 342 } |
| 345 devtools_bindings_->delegate_->RenderProcessGone(crashed); | 343 devtools_bindings_->delegate_->RenderProcessGone(crashed); |
| 346 } | 344 } |
| 347 | 345 |
| 348 void DevToolsUIBindings::FrontendWebContentsObserver:: | 346 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 349 AboutToNavigateRenderFrame(content::RenderFrameHost* old_host, | 347 DidStartNavigationToPendingEntry( |
| 350 content::RenderFrameHost* new_host) { | 348 const GURL& url, |
| 351 if (new_host->GetParent()) | 349 content::NavigationController::ReloadType reload_type) { |
| 352 return; | |
| 353 devtools_bindings_->frontend_host_.reset( | 350 devtools_bindings_->frontend_host_.reset( |
| 354 content::DevToolsFrontendHost::Create(new_host, | 351 content::DevToolsFrontendHost::Create(web_contents()->GetMainFrame(), |
| 355 devtools_bindings_)); | 352 devtools_bindings_)); |
| 356 } | 353 } |
| 357 | 354 |
| 358 void DevToolsUIBindings::FrontendWebContentsObserver:: | 355 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 359 DocumentOnLoadCompletedInMainFrame() { | 356 DocumentOnLoadCompletedInMainFrame() { |
| 360 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); | 357 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); |
| 361 } | 358 } |
| 362 | 359 |
| 363 void DevToolsUIBindings::FrontendWebContentsObserver:: | 360 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 364 DidNavigateMainFrame(const content::LoadCommittedDetails& details, | 361 DidNavigateMainFrame(const content::LoadCommittedDetails& details, |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 void DevToolsUIBindings::FrontendLoaded() { | 1140 void DevToolsUIBindings::FrontendLoaded() { |
| 1144 if (frontend_loaded_) | 1141 if (frontend_loaded_) |
| 1145 return; | 1142 return; |
| 1146 frontend_loaded_ = true; | 1143 frontend_loaded_ = true; |
| 1147 | 1144 |
| 1148 // Call delegate first - it seeds importants bit of information. | 1145 // Call delegate first - it seeds importants bit of information. |
| 1149 delegate_->OnLoadCompleted(); | 1146 delegate_->OnLoadCompleted(); |
| 1150 | 1147 |
| 1151 AddDevToolsExtensionsToClient(); | 1148 AddDevToolsExtensionsToClient(); |
| 1152 } | 1149 } |
| OLD | NEW |