WebContentsObserver no longer provides explicit_set, we can calculate it

This commit is contained in:
Samuel Attard 2017-12-18 11:19:21 +11:00 committed by Aleksei Kuzmin
parent fb55db665c
commit 4666879f94
2 changed files with 10 additions and 3 deletions

View file

@ -893,9 +893,16 @@ void WebContents::DidFinishNavigation(
} }
} }
void WebContents::TitleWasSet(content::NavigationEntry* entry, void WebContents::TitleWasSet(content::NavigationEntry* entry) {
bool explicit_set) {
auto title = entry ? entry->GetTitle() : base::string16(); auto title = entry ? entry->GetTitle() : base::string16();
bool explicit_set;
if (entry && entry->GetURL().SchemeIsFile() && title.empty()) {
final_title = base::UTF8ToUTF16(entry->GetURL().ExtractFileName());
explicit_set = false;
} else {
base::TrimWhitespace(title, base::TRIM_ALL, &final_title);
explicit_set = true;
}
Emit("page-title-updated", title, explicit_set); Emit("page-title-updated", title, explicit_set);
} }

View file

@ -361,7 +361,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
void WebContentsDestroyed() override; void WebContentsDestroyed() override;
void NavigationEntryCommitted( void NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) override; const content::LoadCommittedDetails& load_details) override;
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override; void TitleWasSet(content::NavigationEntry* entry) override;
void DidUpdateFaviconURL( void DidUpdateFaviconURL(
const std::vector<content::FaviconURL>& urls) override; const std::vector<content::FaviconURL>& urls) override;
void PluginCrashed(const base::FilePath& plugin_path, void PluginCrashed(const base::FilePath& plugin_path,