| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 explicit FrontendWebContentsObserver(DevToolsUIBindings* ui_bindings); | 442 explicit FrontendWebContentsObserver(DevToolsUIBindings* ui_bindings); |
| 443 ~FrontendWebContentsObserver() override; | 443 ~FrontendWebContentsObserver() override; |
| 444 | 444 |
| 445 private: | 445 private: |
| 446 // contents::WebContentsObserver: | 446 // contents::WebContentsObserver: |
| 447 void RenderProcessGone(base::TerminationStatus status) override; | 447 void RenderProcessGone(base::TerminationStatus status) override; |
| 448 void ReadyToCommitNavigation( | 448 void ReadyToCommitNavigation( |
| 449 content::NavigationHandle* navigation_handle) override; | 449 content::NavigationHandle* navigation_handle) override; |
| 450 void DocumentAvailableInMainFrame() override; | 450 void DocumentAvailableInMainFrame() override; |
| 451 void DocumentOnLoadCompletedInMainFrame() override; | 451 void DocumentOnLoadCompletedInMainFrame() override; |
| 452 void DidNavigateMainFrame( | 452 void DidFinishNavigation( |
| 453 const content::LoadCommittedDetails& details, | 453 content::NavigationHandle* navigation_handle) override; |
| 454 const content::FrameNavigateParams& params) override; | |
| 455 | 454 |
| 456 DevToolsUIBindings* devtools_bindings_; | 455 DevToolsUIBindings* devtools_bindings_; |
| 457 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); | 456 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); |
| 458 }; | 457 }; |
| 459 | 458 |
| 460 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( | 459 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( |
| 461 DevToolsUIBindings* devtools_ui_bindings) | 460 DevToolsUIBindings* devtools_ui_bindings) |
| 462 : WebContentsObserver(devtools_ui_bindings->web_contents()), | 461 : WebContentsObserver(devtools_ui_bindings->web_contents()), |
| 463 devtools_bindings_(devtools_ui_bindings) { | 462 devtools_bindings_(devtools_ui_bindings) { |
| 464 } | 463 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 break; | 498 break; |
| 500 default: | 499 default: |
| 501 crashed = false; | 500 crashed = false; |
| 502 break; | 501 break; |
| 503 } | 502 } |
| 504 devtools_bindings_->delegate_->RenderProcessGone(crashed); | 503 devtools_bindings_->delegate_->RenderProcessGone(crashed); |
| 505 } | 504 } |
| 506 | 505 |
| 507 void DevToolsUIBindings::FrontendWebContentsObserver::ReadyToCommitNavigation( | 506 void DevToolsUIBindings::FrontendWebContentsObserver::ReadyToCommitNavigation( |
| 508 content::NavigationHandle* navigation_handle) { | 507 content::NavigationHandle* navigation_handle) { |
| 509 if (!navigation_handle->IsInMainFrame()) | 508 if (navigation_handle->IsInMainFrame()) |
| 510 return; | 509 devtools_bindings_->UpdateFrontendHost(navigation_handle); |
| 511 devtools_bindings_->UpdateFrontendHost(navigation_handle); | |
| 512 } | 510 } |
| 513 | 511 |
| 514 void DevToolsUIBindings::FrontendWebContentsObserver:: | 512 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 515 DocumentAvailableInMainFrame() { | 513 DocumentAvailableInMainFrame() { |
| 516 devtools_bindings_->DocumentAvailableInMainFrame(); | 514 devtools_bindings_->DocumentAvailableInMainFrame(); |
| 517 } | 515 } |
| 518 | 516 |
| 519 void DevToolsUIBindings::FrontendWebContentsObserver:: | 517 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 520 DocumentOnLoadCompletedInMainFrame() { | 518 DocumentOnLoadCompletedInMainFrame() { |
| 521 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); | 519 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); |
| 522 } | 520 } |
| 523 | 521 |
| 524 void DevToolsUIBindings::FrontendWebContentsObserver:: | 522 void DevToolsUIBindings::FrontendWebContentsObserver::DidFinishNavigation( |
| 525 DidNavigateMainFrame(const content::LoadCommittedDetails& details, | 523 content::NavigationHandle* navigation_handle) { |
| 526 const content::FrameNavigateParams& params) { | 524 if (navigation_handle->IsInMainFrame() && navigation_handle->HasCommitted()) |
| 527 devtools_bindings_->DidNavigateMainFrame(); | 525 devtools_bindings_->DidNavigateMainFrame(); |
| 528 } | 526 } |
| 529 | 527 |
| 530 // DevToolsUIBindings --------------------------------------------------------- | 528 // DevToolsUIBindings --------------------------------------------------------- |
| 531 | 529 |
| 532 DevToolsUIBindings* DevToolsUIBindings::ForWebContents( | 530 DevToolsUIBindings* DevToolsUIBindings::ForWebContents( |
| 533 content::WebContents* web_contents) { | 531 content::WebContents* web_contents) { |
| 534 if (g_instances == NULL) | 532 if (g_instances == NULL) |
| 535 return NULL; | 533 return NULL; |
| 536 DevToolsUIBindingsList* instances = g_instances.Pointer(); | 534 DevToolsUIBindingsList* instances = g_instances.Pointer(); |
| 537 for (DevToolsUIBindingsList::iterator it(instances->begin()); | 535 for (DevToolsUIBindingsList::iterator it(instances->begin()); |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 void DevToolsUIBindings::FrontendLoaded() { | 1345 void DevToolsUIBindings::FrontendLoaded() { |
| 1348 if (frontend_loaded_) | 1346 if (frontend_loaded_) |
| 1349 return; | 1347 return; |
| 1350 frontend_loaded_ = true; | 1348 frontend_loaded_ = true; |
| 1351 | 1349 |
| 1352 // Call delegate first - it seeds importants bit of information. | 1350 // Call delegate first - it seeds importants bit of information. |
| 1353 delegate_->OnLoadCompleted(); | 1351 delegate_->OnLoadCompleted(); |
| 1354 | 1352 |
| 1355 AddDevToolsExtensionsToClient(); | 1353 AddDevToolsExtensionsToClient(); |
| 1356 } | 1354 } |
| OLD | NEW |