Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 12041059: content: convert SSL notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | content/browser/ssl/ssl_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (!app_name_.empty()) 374 if (!app_name_.empty())
375 chrome::RegisterAppPrefs(app_name_, profile_); 375 chrome::RegisterAppPrefs(app_name_, profile_);
376 tab_strip_model_->AddObserver(this); 376 tab_strip_model_->AddObserver(this);
377 377
378 toolbar_model_.reset(new ToolbarModelImpl(toolbar_model_delegate_.get())); 378 toolbar_model_.reset(new ToolbarModelImpl(toolbar_model_delegate_.get()));
379 search_model_.reset(new chrome::search::SearchModel(NULL)); 379 search_model_.reset(new chrome::search::SearchModel(NULL));
380 search_delegate_.reset( 380 search_delegate_.reset(
381 new chrome::search::SearchDelegate(search_model_.get(), 381 new chrome::search::SearchDelegate(search_model_.get(),
382 toolbar_model_.get())); 382 toolbar_model_.get()));
383 383
384 registrar_.Add(this, content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED,
385 content::NotificationService::AllSources());
386 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 384 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
387 content::Source<Profile>(profile_->GetOriginalProfile())); 385 content::Source<Profile>(profile_->GetOriginalProfile()));
388 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 386 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
389 content::Source<Profile>(profile_->GetOriginalProfile())); 387 content::Source<Profile>(profile_->GetOriginalProfile()));
390 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 388 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
391 content::Source<Profile>(profile_->GetOriginalProfile())); 389 content::Source<Profile>(profile_->GetOriginalProfile()));
392 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 390 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
393 content::NotificationService::AllSources()); 391 content::NotificationService::AllSources());
394 #if defined(ENABLE_THEMES) 392 #if defined(ENABLE_THEMES)
395 registrar_.Add( 393 registrar_.Add(
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 752
755 //////////////////////////////////////////////////////////////////////////////// 753 ////////////////////////////////////////////////////////////////////////////////
756 // Browser, Tab adding/showing functions: 754 // Browser, Tab adding/showing functions:
757 755
758 void Browser::WindowFullscreenStateChanged() { 756 void Browser::WindowFullscreenStateChanged() {
759 fullscreen_controller_->WindowFullscreenStateChanged(); 757 fullscreen_controller_->WindowFullscreenStateChanged();
760 command_controller_->FullscreenStateChanged(); 758 command_controller_->FullscreenStateChanged();
761 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN); 759 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN);
762 } 760 }
763 761
762 void Browser::VisibleSSLStateChanged(content::WebContents* web_contents) {
763 // When the current tab's SSL state changes, we need to update the URL
764 // bar to reflect the new state.
765 DCHECK(web_contents);
766 if (tab_strip_model_->GetActiveWebContents() == web_contents)
767 UpdateToolbar(false);
768 }
769
764 /////////////////////////////////////////////////////////////////////////////// 770 ///////////////////////////////////////////////////////////////////////////////
765 // Browser, Assorted browser commands: 771 // Browser, Assorted browser commands:
766 772
767 void Browser::ToggleFullscreenModeWithExtension(const GURL& extension_url) { 773 void Browser::ToggleFullscreenModeWithExtension(const GURL& extension_url) {
768 fullscreen_controller_->ToggleFullscreenModeWithExtension(extension_url); 774 fullscreen_controller_->ToggleFullscreenModeWithExtension(extension_url);
769 } 775 }
770 776
771 bool Browser::SupportsWindowFeature(WindowFeature feature) const { 777 bool Browser::SupportsWindowFeature(WindowFeature feature) const {
772 return SupportsWindowFeatureImpl(feature, true); 778 return SupportsWindowFeatureImpl(feature, true);
773 } 779 }
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 false)); 1827 false));
1822 } 1828 }
1823 1829
1824 /////////////////////////////////////////////////////////////////////////////// 1830 ///////////////////////////////////////////////////////////////////////////////
1825 // Browser, content::NotificationObserver implementation: 1831 // Browser, content::NotificationObserver implementation:
1826 1832
1827 void Browser::Observe(int type, 1833 void Browser::Observe(int type,
1828 const content::NotificationSource& source, 1834 const content::NotificationSource& source,
1829 const content::NotificationDetails& details) { 1835 const content::NotificationDetails& details) {
1830 switch (type) { 1836 switch (type) {
1831 case content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED:
1832 // When the current tab's SSL state changes, we need to update the URL
1833 // bar to reflect the new state. Note that it's possible for the selected
1834 // tab contents to be NULL. This is because we listen for all sources
1835 // (NavigationControllers) for convenience, so the notification could
1836 // actually be for a different window while we're doing asynchronous
1837 // closing of this one.
1838 if (tab_strip_model_->GetActiveWebContents() &&
1839 &tab_strip_model_->GetActiveWebContents()->GetController() ==
1840 content::Source<NavigationController>(source).ptr())
1841 UpdateToolbar(false);
1842 break;
1843
1844 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 1837 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
1845 if (window()->GetLocationBar()) 1838 if (window()->GetLocationBar())
1846 window()->GetLocationBar()->UpdatePageActions(); 1839 window()->GetLocationBar()->UpdatePageActions();
1847 1840
1848 // Close any tabs from the unloaded extension, unless it's terminated, 1841 // Close any tabs from the unloaded extension, unless it's terminated,
1849 // in which case let the sad tabs remain. 1842 // in which case let the sad tabs remain.
1850 if (content::Details<extensions::UnloadedExtensionInfo>( 1843 if (content::Details<extensions::UnloadedExtensionInfo>(
1851 details)->reason != extension_misc::UNLOAD_REASON_TERMINATE) { 1844 details)->reason != extension_misc::UNLOAD_REASON_TERMINATE) {
1852 const Extension* extension = 1845 const Extension* extension =
1853 content::Details<extensions::UnloadedExtensionInfo>( 1846 content::Details<extensions::UnloadedExtensionInfo>(
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 if (contents && !allow_js_access) { 2343 if (contents && !allow_js_access) {
2351 contents->web_contents()->GetController().LoadURL( 2344 contents->web_contents()->GetController().LoadURL(
2352 target_url, 2345 target_url,
2353 content::Referrer(), 2346 content::Referrer(),
2354 content::PAGE_TRANSITION_LINK, 2347 content::PAGE_TRANSITION_LINK,
2355 std::string()); // No extra headers. 2348 std::string()); // No extra headers.
2356 } 2349 }
2357 2350
2358 return contents != NULL; 2351 return contents != NULL;
2359 } 2352 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | content/browser/ssl/ssl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698