re-use title information from NavigationEntry
This commit is contained in:
parent
fa3d9d32ae
commit
1f2d229862
1 changed files with 10 additions and 8 deletions
|
@ -894,15 +894,17 @@ void WebContents::DidFinishNavigation(
|
|||
}
|
||||
|
||||
void WebContents::TitleWasSet(content::NavigationEntry* entry) {
|
||||
auto title = entry ? entry->GetTitle() : base::string16();
|
||||
bool explicit_set;
|
||||
base::string16 final_title;
|
||||
if (entry && entry->GetURL().SchemeIsFile() && title.empty()) {
|
||||
final_title = base::UTF8ToUTF16(entry->GetURL().ExtractFileName());
|
||||
bool explicit_set = true;
|
||||
if (entry) {
|
||||
auto title = entry->GetTitle();
|
||||
auto url = entry->GetURL();
|
||||
if (url.SchemeIsFile() && title.empty()) {
|
||||
final_title = base::UTF8ToUTF16(url.ExtractFileName());
|
||||
explicit_set = false;
|
||||
} else {
|
||||
base::TrimWhitespace(title, base::TRIM_ALL, &final_title);
|
||||
explicit_set = true;
|
||||
final_title = title;
|
||||
}
|
||||
}
|
||||
Emit("page-title-updated", final_title, explicit_set);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue