diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-07 23:57:40 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-07 23:57:40 +0000 |
commit | e83f16853d443dd0556b7e8c42f1f6013581715d (patch) | |
tree | 58a34a6602aa351ae1d35c2ab5117a0ffd01089a /chrome/browser/browser.cc | |
parent | f80ea89e0e951089b9f08ea40c2c2b528f3df66f (diff) | |
download | chromium_src-e83f16853d443dd0556b7e8c42f1f6013581715d.zip chromium_src-e83f16853d443dd0556b7e8c42f1f6013581715d.tar.gz chromium_src-e83f16853d443dd0556b7e8c42f1f6013581715d.tar.bz2 |
Fix SSL state in the URL bar being incorrect. Going to an EV site like https://www.verisign.com/ would not should the EV name in the URL bar unless you did something like switch tabs away and back because in my cleanup I removed the notification that this was depending on.
This patch adds a new NOTIFY_SSL_STATE_CHANGED notification which is broadcast by the various SSL components when they update the flags. The browser now listens for this notification and will update the URL bar.
BUG=1359547
TEST=see repro steps in bug
Review URL: http://codereview.chromium.org/436
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 1628952..b2ed3fa 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -234,6 +234,8 @@ Browser::Browser(const gfx::Rect& initial_bounds, AddObserver(this, NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, NotificationService::AllSources()); } + NotificationService::current()->AddObserver( + this, NOTIFY_SSL_STATE_CHANGED, NotificationService::AllSources()); if (profile->HasSessionService()) { SessionService* session_service = profile->GetSessionService(); @@ -287,6 +289,8 @@ Browser::~Browser() { RemoveObserver(this, NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, NotificationService::AllSources()); } + NotificationService::current()->RemoveObserver( + this, NOTIFY_SSL_STATE_CHANGED, NotificationService::AllSources()); // Stop hung plugin monitoring. ticker_.Stop(); @@ -646,14 +650,13 @@ void Browser::NavigationStateChanged(const TabContents* source, } // Only update the UI when something visible has changed. - if (changed_flags && changed_flags != TabContents::INVALIDATE_STATE) + if (changed_flags) ScheduleUIUpdate(source, changed_flags); // We don't schedule updates to the navigation commands since they will only // change once per navigation, so we don't have to worry about flickering. - if (changed_flags & TabContents::INVALIDATE_URL) { + if (changed_flags & TabContents::INVALIDATE_URL) UpdateNavigationCommands(); - } } void Browser::ReplaceContents(TabContents* source, TabContents* new_contents) { @@ -835,26 +838,40 @@ void Browser::ShowHtmlDialog(HtmlDialogContentsDelegate* delegate, void Browser::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) { - DCHECK(!g_browser_process->IsUsingNewFrames()); - TabContents* current_tab = GetSelectedTabContents(); - if (current_tab) { - Profile* event_profile = Source<Profile>(source).ptr(); - if (event_profile->IsSameProfile(current_tab->profile())) { - // This forces the browser to query for the BookmarkBar again. - window_->ShelfVisibilityChanged(); + switch (type) { + case NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: { + DCHECK(!g_browser_process->IsUsingNewFrames()); + TabContents* current_tab = GetSelectedTabContents(); + if (current_tab) { + Profile* event_profile = Source<Profile>(source).ptr(); + if (event_profile->IsSameProfile(current_tab->profile())) { + // This forces the browser to query for the BookmarkBar again. + window_->ShelfVisibilityChanged(); + } } + break; } - } else if (type == NOTIFY_WEB_CONTENTS_DISCONNECTED) { - if (is_attempting_to_close_browser_) { - // Need to do this asynchronously as it will close the tab, which is - // currently on the call stack above us. - MessageLoop::current()->PostTask(FROM_HERE, - method_factory_.NewRunnableMethod(&Browser::ClearUnloadState, - Source<TabContents>(source).ptr())); - } - } else { - NOTREACHED() << "Got a notification we didn't register for."; + + case NOTIFY_WEB_CONTENTS_DISCONNECTED: + if (is_attempting_to_close_browser_) { + // Need to do this asynchronously as it will close the tab, which is + // currently on the call stack above us. + MessageLoop::current()->PostTask(FROM_HERE, + method_factory_.NewRunnableMethod(&Browser::ClearUnloadState, + Source<TabContents>(source).ptr())); + } + break; + + case NOTIFY_SSL_STATE_CHANGED: + // When the current tab's SSL state changes, we need to update the URL + // bar to reflect the new state. + if (GetSelectedTabContents()->controller() == + Source<NavigationController>(source).ptr()) + UpdateToolBar(false); + break; + + default: + NOTREACHED() << "Got a notification we didn't register for."; } } |