Skip to content

Commit

Permalink
Added |load_completion_status| to WebStateObserver's |PageLoaded|.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
kkhorimoto authored and Commit bot committed Jan 7, 2015
1 parent 8e23645 commit 64c5235
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@

// web::WebStateObserver implementation:

void LanguageDetectionController::PageLoaded() {
StartLanguageDetection();
void LanguageDetectionController::PageLoaded(
web::PageLoadCompletionStatus load_completion_status) {
if (load_completion_status == web::PageLoadCompletionStatus::SUCCESS)
StartLanguageDetection();
}

void LanguageDetectionController::URLHashChanged() {
Expand Down
4 changes: 3 additions & 1 deletion ios/web/public/web_state/web_state_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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() {}
Expand Down

0 comments on commit 64c5235

Please sign in to comment.