Commit 64c52354 authored by kkhorimoto's avatar kkhorimoto Committed by Commit bot

Added |load_completion_status| to WebStateObserver's |PageLoaded|.

This CL also introduces the web::PageLoadCompletionStatus enum.
This was done to support future WebStateObserver subclasses that
require notifications of failed page loads.

BUG=none

Review URL: https://codereview.chromium.org/835203002

Cr-Commit-Position: refs/heads/master@{#310188}
parent 8e236456
......@@ -76,7 +76,8 @@ class LanguageDetectionController : public web::WebStateObserver {
const base::string16& text);
// web::WebStateObserver implementation:
void PageLoaded() override;
void PageLoaded(
web::PageLoadCompletionStatus load_completion_status) override;
void URLHashChanged() override;
void HistoryStateChanged() override;
void WebStateDestroyed() override;
......
......@@ -127,7 +127,9 @@ void LanguageDetectionController::OnTextRetrieved(
// web::WebStateObserver implementation:
void LanguageDetectionController::PageLoaded() {
void LanguageDetectionController::PageLoaded(
web::PageLoadCompletionStatus load_completion_status) {
if (load_completion_status == web::PageLoadCompletionStatus::SUCCESS)
StartLanguageDetection();
}
......
......@@ -13,6 +13,8 @@ struct LoadCommittedDetails;
class WebState;
class WebStateImpl;
enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 };
// An observer API implemented by classes which are interested in various page
// load events from WebState.
class WebStateObserver {
......@@ -28,7 +30,7 @@ class WebStateObserver {
const LoadCommittedDetails& load_details) {}
// Called when the current page is loaded.
virtual void PageLoaded() {}
virtual void PageLoaded(PageLoadCompletionStatus load_completion_status) {}
// Called on URL hash change events.
virtual void URLHashChanged() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment