diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-14 18:47:49 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-14 18:47:49 +0000 |
commit | 24f98bbac219f4fe06cf445b36b17cd35a74c66f (patch) | |
tree | cdfd3751925bb7b9cbf4068596643310a1bd2f24 | |
parent | a5d0f4bc0d2891cc7fa372d245ebf46332259d7d (diff) | |
download | chromium_src-24f98bbac219f4fe06cf445b36b17cd35a74c66f.zip chromium_src-24f98bbac219f4fe06cf445b36b17cd35a74c66f.tar.gz chromium_src-24f98bbac219f4fe06cf445b36b17cd35a74c66f.tar.bz2 |
Ensure that the correct URL and title is displayed in the host browser if the browser tab
is attached to an existing external tab. This can happen if a script running in chrome invokes
window.open which opens a popup window. To ensure that the title and URL display correctly we
send over the navigation state changed IPC from Chrome when we receive an IPC from ChromeFrame
indicating that it connected to the external tab.
I also made a change to the function which sends over the
navigation state to chrome to ensure that we set the title
to the URL if it is empty. This mimics Chrome and the other
browser's behavior.
This should fix http://code.google.com/p/chromium/issues/detail?id=24024
Bug=24024
Review URL: http://codereview.chromium.org/274035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28991 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/external_tab_container.cc | 20 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.h | 4 |
2 files changed, 20 insertions, 4 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 4529ac3..bcd9dbe 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -41,7 +41,8 @@ ExternalTabContainer::ExternalTabContainer( ignore_next_load_notification_(false), automation_resource_message_filter_(filter), load_requests_via_automation_(false), - handle_top_level_requests_(false) { + handle_top_level_requests_(false), + external_method_factory_(this) { } ExternalTabContainer::~ExternalTabContainer() { @@ -133,8 +134,10 @@ bool ExternalTabContainer::Init(Profile* profile, // Start loading initial URL if (!initial_url.is_empty()) { // Navigate out of context since we don't have a 'tab_handle_' yet. - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( - this, &ExternalTabContainer::Navigate, initial_url, GURL())); + MessageLoop::current()->PostTask( + FROM_HERE, + external_method_factory_.NewRunnableMethod( + &ExternalTabContainer::Navigate, initial_url, GURL())); } // We need WS_POPUP to be on the window during initialization, but @@ -199,6 +202,12 @@ bool ExternalTabContainer::Reinitialize( automation_profile_->Initialize(profile, filter); } + // We cannot send the navigation state right away as the automation channel + // may not have been fully setup yet. + MessageLoop::current()->PostTask( + FROM_HERE, + external_method_factory_.NewRunnableMethod( + &ExternalTabContainer::NavigationStateChanged, tab_contents_, 0)); return true; } @@ -609,8 +618,11 @@ bool ExternalTabContainer::InitNavigationInfo(IPC::NavigationInfo* nav_info, nav_info->relative_offset = relative_offset; nav_info->navigation_index = tab_contents_->controller().GetCurrentEntryIndex(); - nav_info->title = UTF16ToWideHack(entry->title()); nav_info->url = entry->url(); + nav_info->title = UTF16ToWideHack(entry->title()); + if (nav_info->title.empty()) + nav_info->title = UTF8ToWide(nav_info->url.spec()); + nav_info->security_style = entry->ssl().security_style(); nav_info->has_mixed_content = entry->ssl().has_mixed_content(); return true; diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h index 1438f5d..879a147 100644 --- a/chrome/browser/external_tab_container.h +++ b/chrome/browser/external_tab_container.h @@ -210,6 +210,10 @@ class ExternalTabContainer : public TabContentsDelegate, // Contains ExternalTabContainers that have not been connected to as yet. static PendingTabs pending_tabs_; + // Allows us to run tasks on the ExternalTabContainer instance which are + // bound by its lifetime. + ScopedRunnableMethodFactory<ExternalTabContainer> external_method_factory_; + DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer); }; |