| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 content::Source<Profile>(profile_)); | 306 content::Source<Profile>(profile_)); |
| 307 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, | 307 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |
| 308 content::NotificationService::AllSources()); | 308 content::NotificationService::AllSources()); |
| 309 registrar_.Add( | 309 registrar_.Add( |
| 310 this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 310 this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 311 content::Source<ThemeService>( | 311 content::Source<ThemeService>( |
| 312 ThemeServiceFactory::GetForProfile(profile_))); | 312 ThemeServiceFactory::GetForProfile(profile_))); |
| 313 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, | 313 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, |
| 314 content::NotificationService::AllSources()); | 314 content::NotificationService::AllSources()); |
| 315 | 315 |
| 316 // Need to know when to alert the user of theme install delay. | |
| 317 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_READY_FOR_INSTALL, | |
| 318 content::NotificationService::AllSources()); | |
| 319 | |
| 320 PrefService* local_state = g_browser_process->local_state(); | 316 PrefService* local_state = g_browser_process->local_state(); |
| 321 if (local_state) { | 317 if (local_state) { |
| 322 local_pref_registrar_.Init(local_state); | 318 local_pref_registrar_.Init(local_state); |
| 323 local_pref_registrar_.Add(prefs::kPrintingEnabled, this); | 319 local_pref_registrar_.Add(prefs::kPrintingEnabled, this); |
| 324 local_pref_registrar_.Add(prefs::kAllowFileSelectionDialogs, this); | 320 local_pref_registrar_.Add(prefs::kAllowFileSelectionDialogs, this); |
| 325 local_pref_registrar_.Add(prefs::kMetricsReportingEnabled, this); | 321 local_pref_registrar_.Add(prefs::kMetricsReportingEnabled, this); |
| 326 } | 322 } |
| 327 | 323 |
| 328 profile_pref_registrar_.Init(profile_->GetPrefs()); | 324 profile_pref_registrar_.Init(profile_->GetPrefs()); |
| 329 profile_pref_registrar_.Add(prefs::kDevToolsDisabled, this); | 325 profile_pref_registrar_.Add(prefs::kDevToolsDisabled, this); |
| (...skipping 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3775 shelf->AddDownload(new DownloadItemModel(download)); | 3771 shelf->AddDownload(new DownloadItemModel(download)); |
| 3776 // Don't show the animation for "Save file" downloads. | 3772 // Don't show the animation for "Save file" downloads. |
| 3777 // For non-theme extensions, we don't show the download animation. | 3773 // For non-theme extensions, we don't show the download animation. |
| 3778 // Show animation in same window as the download shelf. Download shelf | 3774 // Show animation in same window as the download shelf. Download shelf |
| 3779 // may not be in the same window that initiated the download, e.g. | 3775 // may not be in the same window that initiated the download, e.g. |
| 3780 // Panels. | 3776 // Panels. |
| 3781 // Don't show the animation if the selected tab is not visible (i.e. the | 3777 // Don't show the animation if the selected tab is not visible (i.e. the |
| 3782 // window is minimized, we're in a unit test, etc.). | 3778 // window is minimized, we're in a unit test, etc.). |
| 3783 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); | 3779 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); |
| 3784 if ((download->total_bytes() > 0) && | 3780 if ((download->total_bytes() > 0) && |
| 3785 (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || | 3781 !ChromeDownloadManagerDelegate::IsExtensionDownload(download) && |
| 3786 ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) && | |
| 3787 platform_util::IsVisible(shelf_tab->GetNativeView()) && | 3782 platform_util::IsVisible(shelf_tab->GetNativeView()) && |
| 3788 ui::Animation::ShouldRenderRichAnimation()) { | 3783 ui::Animation::ShouldRenderRichAnimation()) { |
| 3789 DownloadStartedAnimation::Show(shelf_tab); | 3784 DownloadStartedAnimation::Show(shelf_tab); |
| 3790 } | 3785 } |
| 3791 #endif | 3786 #endif |
| 3792 } | 3787 } |
| 3793 | 3788 |
| 3794 // If the download occurs in a new tab, close it. | 3789 // If the download occurs in a new tab, close it. |
| 3795 if (source->controller().IsInitialNavigation() && tab_count() > 1) | 3790 if (source->controller().IsInitialNavigation() && tab_count() > 1) |
| 3796 CloseContents(source); | 3791 CloseContents(source); |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4297 // makes it possible for us to end up here before window creation has | 4292 // makes it possible for us to end up here before window creation has |
| 4298 // completed,at which point window_ is NULL. See 94752 for details. | 4293 // completed,at which point window_ is NULL. See 94752 for details. |
| 4299 if (window() && window()->GetLocationBar()) | 4294 if (window() && window()->GetLocationBar()) |
| 4300 window()->GetLocationBar()->UpdatePageActions(); | 4295 window()->GetLocationBar()->UpdatePageActions(); |
| 4301 break; | 4296 break; |
| 4302 | 4297 |
| 4303 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: | 4298 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: |
| 4304 window()->UserChangedTheme(); | 4299 window()->UserChangedTheme(); |
| 4305 break; | 4300 break; |
| 4306 | 4301 |
| 4307 case chrome::NOTIFICATION_EXTENSION_READY_FOR_INSTALL: { | |
| 4308 Profile* profile = content::Source<Profile>(source).ptr(); | |
| 4309 if (profile_->IsSameProfile(profile)) { | |
| 4310 // Handle EXTENSION_READY_FOR_INSTALL for last active tabbed browser. | |
| 4311 if (BrowserList::FindTabbedBrowser(profile, true) == this) { | |
| 4312 // We only want to show the loading dialog for themes, but we don't | |
| 4313 // want to wait until unpack to find out an extension is a theme, so | |
| 4314 // we test the download_url GURL instead. This means that themes in | |
| 4315 // the extensions gallery won't get the loading dialog. | |
| 4316 GURL download_url = *(content::Details<GURL>(details).ptr()); | |
| 4317 if (ExtensionService::IsDownloadFromMiniGallery(download_url)) | |
| 4318 window()->ShowThemeInstallBubble(); | |
| 4319 } | |
| 4320 } | |
| 4321 break; | |
| 4322 } | |
| 4323 | |
| 4324 case chrome::NOTIFICATION_PREF_CHANGED: { | 4302 case chrome::NOTIFICATION_PREF_CHANGED: { |
| 4325 const std::string& pref_name = | 4303 const std::string& pref_name = |
| 4326 *content::Details<std::string>(details).ptr(); | 4304 *content::Details<std::string>(details).ptr(); |
| 4327 if (pref_name == prefs::kPrintingEnabled) { | 4305 if (pref_name == prefs::kPrintingEnabled) { |
| 4328 UpdatePrintingState(GetContentRestrictionsForSelectedTab()); | 4306 UpdatePrintingState(GetContentRestrictionsForSelectedTab()); |
| 4329 } else if (pref_name == prefs::kInstantEnabled || | 4307 } else if (pref_name == prefs::kInstantEnabled || |
| 4330 pref_name == prefs::kMetricsReportingEnabled || | 4308 pref_name == prefs::kMetricsReportingEnabled || |
| 4331 pref_name == prefs::kSearchSuggestEnabled) { | 4309 pref_name == prefs::kSearchSuggestEnabled) { |
| 4332 if (!InstantController::IsEnabled(profile())) { | 4310 if (!InstantController::IsEnabled(profile())) { |
| 4333 if (instant()) { | 4311 if (instant()) { |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5522 } | 5500 } |
| 5523 | 5501 |
| 5524 void Browser::UpdateFullscreenExitBubbleContent() { | 5502 void Browser::UpdateFullscreenExitBubbleContent() { |
| 5525 GURL url; | 5503 GURL url; |
| 5526 if (fullscreened_tab_) | 5504 if (fullscreened_tab_) |
| 5527 url = fullscreened_tab_->tab_contents()->GetURL(); | 5505 url = fullscreened_tab_->tab_contents()->GetURL(); |
| 5528 | 5506 |
| 5529 window_->UpdateFullscreenExitBubbleContent( | 5507 window_->UpdateFullscreenExitBubbleContent( |
| 5530 url, GetFullscreenExitBubbleType()); | 5508 url, GetFullscreenExitBubbleType()); |
| 5531 } | 5509 } |
| OLD | NEW |