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

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

Issue 11644059: Change infobar creation to use a public static Create() method on the infobar delegate classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/startup/startup_browser_creator_impl.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/environment.h" 14 #include "base/environment.h"
15 #include "base/event_recorder.h" 15 #include "base/event_recorder.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/metrics/statistics_recorder.h" 19 #include "base/metrics/statistics_recorder.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/string_number_conversions.h" 21 #include "base/string_number_conversions.h"
22 #include "base/string_split.h" 22 #include "base/string_split.h"
23 #include "base/threading/thread_restrictions.h" 23 #include "base/threading/thread_restrictions.h"
24 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
25 #include "chrome/browser/api/infobars/infobar_service.h"
25 #include "chrome/browser/auto_launch_trial.h" 26 #include "chrome/browser/auto_launch_trial.h"
26 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
27 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 28 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
28 #include "chrome/browser/defaults.h" 29 #include "chrome/browser/defaults.h"
29 #include "chrome/browser/extensions/app_restore_service.h" 30 #include "chrome/browser/extensions/app_restore_service.h"
30 #include "chrome/browser/extensions/app_restore_service_factory.h" 31 #include "chrome/browser/extensions/app_restore_service_factory.h"
31 #include "chrome/browser/extensions/extension_creator.h" 32 #include "chrome/browser/extensions/extension_creator.h"
32 #include "chrome/browser/extensions/extension_service.h" 33 #include "chrome/browser/extensions/extension_service.h"
33 #include "chrome/browser/extensions/pack_extension_job.h" 34 #include "chrome/browser/extensions/pack_extension_job.h"
34 #include "chrome/browser/first_run/first_run.h" 35 #include "chrome/browser/first_run/first_run.h"
(...skipping 17 matching lines...) Expand all
52 #include "chrome/browser/ui/browser_list.h" 53 #include "chrome/browser/ui/browser_list.h"
53 #include "chrome/browser/ui/browser_navigator.h" 54 #include "chrome/browser/ui/browser_navigator.h"
54 #include "chrome/browser/ui/browser_tabrestore.h" 55 #include "chrome/browser/ui/browser_tabrestore.h"
55 #include "chrome/browser/ui/browser_tabstrip.h" 56 #include "chrome/browser/ui/browser_tabstrip.h"
56 #include "chrome/browser/ui/browser_window.h" 57 #include "chrome/browser/ui/browser_window.h"
57 #include "chrome/browser/ui/extensions/application_launch.h" 58 #include "chrome/browser/ui/extensions/application_launch.h"
58 #include "chrome/browser/ui/host_desktop.h" 59 #include "chrome/browser/ui/host_desktop.h"
59 #include "chrome/browser/ui/startup/autolaunch_prompt.h" 60 #include "chrome/browser/ui/startup/autolaunch_prompt.h"
60 #include "chrome/browser/ui/startup/bad_flags_prompt.h" 61 #include "chrome/browser/ui/startup/bad_flags_prompt.h"
61 #include "chrome/browser/ui/startup/default_browser_prompt.h" 62 #include "chrome/browser/ui/startup/default_browser_prompt.h"
62 #include "chrome/browser/ui/startup/obsolete_os_prompt.h" 63 #include "chrome/browser/ui/startup/obsolete_os_info_bar.h"
63 #include "chrome/browser/ui/startup/session_crashed_prompt.h" 64 #include "chrome/browser/ui/startup/session_crashed_prompt.h"
64 #include "chrome/browser/ui/startup/startup_browser_creator.h" 65 #include "chrome/browser/ui/startup/startup_browser_creator.h"
65 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" 66 #include "chrome/browser/ui/tabs/pinned_tab_codec.h"
66 #include "chrome/browser/ui/tabs/tab_strip_model.h" 67 #include "chrome/browser/ui/tabs/tab_strip_model.h"
67 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 68 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
68 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" 69 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h"
69 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 70 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
70 #include "chrome/common/chrome_constants.h" 71 #include "chrome/common/chrome_constants.h"
71 #include "chrome/common/chrome_notification_types.h" 72 #include "chrome/common/chrome_notification_types.h"
72 #include "chrome/common/chrome_paths.h" 73 #include "chrome/common/chrome_paths.h"
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 return browser; 850 return browser;
850 } 851 }
851 852
852 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary( 853 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary(
853 Browser* browser, 854 Browser* browser,
854 chrome::startup::IsProcessStartup is_process_startup) { 855 chrome::startup::IsProcessStartup is_process_startup) {
855 if (!browser || !profile_ || browser->tab_count() == 0) 856 if (!browser || !profile_ || browser->tab_count() == 0)
856 return; 857 return;
857 858
858 if (HasPendingUncleanExit(browser->profile())) 859 if (HasPendingUncleanExit(browser->profile()))
859 chrome::ShowSessionCrashedPrompt(browser); 860 SessionCrashedInfoBarDelegate::Create(browser);
860 861
861 // The bad flags info bar and the obsolete system info bar are only added to 862 // The bad flags info bar and the obsolete system info bar are only added to
862 // the first profile which is launched. Other profiles might be restoring the 863 // the first profile which is launched. Other profiles might be restoring the
863 // browsing sessions asynchronously, so we cannot add the info bars to the 864 // browsing sessions asynchronously, so we cannot add the info bars to the
864 // focused tabs here. 865 // focused tabs here.
865 if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP) { 866 if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP) {
866 chrome::ShowBadFlagsPrompt(browser); 867 chrome::ShowBadFlagsPrompt(browser);
867 chrome::ShowObsoleteOSPrompt(browser); 868 chrome::ObsoleteOSInfoBar::Create(
869 InfoBarService::FromWebContents(chrome::GetActiveWebContents(browser)));
868 870
869 if (browser_defaults::kOSSupportsOtherBrowsers && 871 if (browser_defaults::kOSSupportsOtherBrowsers &&
870 !command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) { 872 !command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) {
871 // Generally, the default browser prompt should not be shown on first 873 // Generally, the default browser prompt should not be shown on first
872 // run. However, when the set-as-default dialog has been suppressed, we 874 // run. However, when the set-as-default dialog has been suppressed, we
873 // need to allow it. 875 // need to allow it.
874 if ((!is_first_run_ || 876 if ((!is_first_run_ ||
875 (browser_creator_ && 877 (browser_creator_ &&
876 browser_creator_->is_default_browser_dialog_suppressed())) && 878 browser_creator_->is_default_browser_dialog_suppressed())) &&
877 !chrome::ShowAutolaunchPrompt(browser)) { 879 !chrome::ShowAutolaunchPrompt(browser)) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 } 956 }
955 957
956 #if !defined(OS_WIN) || defined(USE_AURA) 958 #if !defined(OS_WIN) || defined(USE_AURA)
957 // static 959 // static
958 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( 960 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser(
959 Profile* profile, 961 Profile* profile,
960 const std::vector<GURL>& startup_urls) { 962 const std::vector<GURL>& startup_urls) {
961 return false; 963 return false;
962 } 964 }
963 #endif 965 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/session_crashed_prompt.cc ('k') | chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698