[EWK] "title,changed" callback invoked on back and forward actions
authorWojciech Bielawski <w.bielawski@samsung.com>
Wed, 18 Nov 2015 09:27:07 +0000 (10:27 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 07:55:23 +0000 (07:55 +0000)
Chromium by default doesn't inform view delegates when a page is
reloaded as a result of back and forward actions (the title doesn't
change indeed). This patch modifies this behaviour to fulfill EWK API
requirements.

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=14206
Together with: I0c6d2110836b6122e51311e3b6f3cb56dcf3dd79

Original beta/m42 patch:
http://165.213.202.130/gerrit/#/c/85470/

Reviewed by: a.renevier, a1.gomes, djmix.kim, j.majnert, sns.park

Change-Id: I039d6ea43939c38ad1550f78475b20a12a8c5b08
Signed-off-by: Wojciech Bielawski <w.bielawski@samsung.com>
tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc
tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.h

index 9779526..e299f36 100644 (file)
 
 #include "content/browser/web_contents/web_contents_impl_efl.h"
 
+#include "base/strings/utf_string_conversions.h"
 #include "content/public/common/content_client.h"
 #include "content/common/view_messages.h"
 #include "content/browser/browser_plugin/browser_plugin_guest.h"
 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
+#include "content/browser/frame_host/navigation_entry_impl.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
 #include "content/browser/web_contents/web_contents_view.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_plugin_guest_manager.h"
 #include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_types.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/browser/user_metrics.h"
 #include "content/public/browser/web_contents_delegate.h"
@@ -372,4 +376,24 @@ WebContents* WebContentsImplEfl::HandleNewWebContentsCreate(
   return new_contents;
 }
 
+bool WebContentsImplEfl::UpdateTitleForEntry(NavigationEntryImpl* entry,
+                                             const base::string16& title) {
+  bool updated = WebContentsImpl::UpdateTitleForEntry(entry, title);
+  // inform view even if the title didn't change to keep EWK consistency
+  if (!updated) {
+    // For file URLs without a title, use the pathname instead. In the case of a
+    // synthesized title, we don't want the update to count toward the "one set
+    // per page of the title to history."
+    base::string16 final_title;
+    if (entry && entry->GetURL().SchemeIsFile() && title.empty())
+      final_title = base::UTF8ToUTF16(entry->GetURL().ExtractFileName());
+    else
+      base::TrimWhitespace(title, base::TRIM_ALL, &final_title);
+
+    view_->SetPageTitle(final_title);
+  }
+
+  return updated;
+}
+
 }
index 54633fe..5732a8b 100644 (file)
@@ -62,6 +62,9 @@ class CONTENT_EXPORT WebContentsImplEfl : public WebContentsImpl {
       SessionStorageNamespace* session_storage_namespace,
       void* platform_data);
 
+  bool UpdateTitleForEntry(NavigationEntryImpl* entry,
+                           const base::string16& title) override;
+
   void* platform_data_;
 
   scoped_ptr<WebContentsEflDelegate> efl_delegate_;