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

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

Issue 345037: Fifth patch in getting rid of caching MessageLoop pointers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser_init.h" 5 #include "chrome/browser/browser_init.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/event_recorder.h" 9 #include "base/event_recorder.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/sys_info.h" 11 #include "base/sys_info.h"
12 #include "base/thread.h"
13 #include "chrome/browser/automation/automation_provider.h" 12 #include "chrome/browser/automation/automation_provider.h"
14 #include "chrome/browser/browser_list.h" 13 #include "chrome/browser/browser_list.h"
15 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/browser_window.h" 15 #include "chrome/browser/browser_window.h"
16 #include "chrome/browser/chrome_thread.h"
17 #include "chrome/browser/defaults.h" 17 #include "chrome/browser/defaults.h"
18 #include "chrome/browser/extensions/extension_creator.h" 18 #include "chrome/browser/extensions/extension_creator.h"
19 #include "chrome/browser/first_run.h" 19 #include "chrome/browser/first_run.h"
20 #include "chrome/browser/net/dns_global.h" 20 #include "chrome/browser/net/dns_global.h"
21 #include "chrome/browser/profile.h" 21 #include "chrome/browser/profile.h"
22 #include "chrome/browser/renderer_host/render_process_host.h" 22 #include "chrome/browser/renderer_host/render_process_host.h"
23 #include "chrome/browser/search_engines/template_url_model.h" 23 #include "chrome/browser/search_engines/template_url_model.h"
24 #include "chrome/browser/session_startup_pref.h" 24 #include "chrome/browser/session_startup_pref.h"
25 #include "chrome/browser/sessions/session_restore.h" 25 #include "chrome/browser/sessions/session_restore.h"
26 #include "chrome/browser/shell_integration.h" 26 #include "chrome/browser/shell_integration.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return; 167 return;
168 tab->AddInfoBar(new DefaultBrowserInfoBarDelegate(tab)); 168 tab->AddInfoBar(new DefaultBrowserInfoBarDelegate(tab));
169 } 169 }
170 170
171 private: 171 private:
172 DISALLOW_COPY_AND_ASSIGN(NotifyNotDefaultBrowserTask); 172 DISALLOW_COPY_AND_ASSIGN(NotifyNotDefaultBrowserTask);
173 }; 173 };
174 174
175 class CheckDefaultBrowserTask : public Task { 175 class CheckDefaultBrowserTask : public Task {
176 public: 176 public:
177 explicit CheckDefaultBrowserTask(MessageLoop* ui_loop) : ui_loop_(ui_loop) { 177 CheckDefaultBrowserTask() {
178 } 178 }
179 179
180 virtual void Run() { 180 virtual void Run() {
181 if (!ShellIntegration::IsDefaultBrowser()) 181 if (ShellIntegration::IsDefaultBrowser())
182 ui_loop_->PostTask(FROM_HERE, new NotifyNotDefaultBrowserTask()); 182 return;
183
184 ChromeThread::PostTask(
185 ChromeThread::UI, FROM_HERE, new NotifyNotDefaultBrowserTask());
183 } 186 }
184 187
185 private: 188 private:
186 MessageLoop* ui_loop_;
187 189
cpu_(ooo_6.6-7.5) 2009/11/03 02:16:24 remove blank line?
jam 2009/11/03 03:52:47 Done.
188 DISALLOW_COPY_AND_ASSIGN(CheckDefaultBrowserTask); 190 DISALLOW_COPY_AND_ASSIGN(CheckDefaultBrowserTask);
189 }; 191 };
190 192
191 // A delegate for the InfoBar shown when the previous session has crashed. The 193 // A delegate for the InfoBar shown when the previous session has crashed. The
192 // bar deletes itself automatically after it is closed. 194 // bar deletes itself automatically after it is closed.
193 // TODO(timsteele): This delegate can leak when a tab is closed, see 195 // TODO(timsteele): This delegate can leak when a tab is closed, see
194 // http://crbug.com/6520 196 // http://crbug.com/6520
195 class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate { 197 class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate {
196 public: 198 public:
197 explicit SessionCrashedInfoBarDelegate(TabContents* contents) 199 explicit SessionCrashedInfoBarDelegate(TabContents* contents)
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 669 }
668 670
669 void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) { 671 void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) {
670 // We do not check if we are the default browser if: 672 // We do not check if we are the default browser if:
671 // - the user said "don't ask me again" on the infobar earlier. 673 // - the user said "don't ask me again" on the infobar earlier.
672 // - this is the first launch after the first run flow. 674 // - this is the first launch after the first run flow.
673 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || 675 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) ||
674 FirstRun::IsChromeFirstRun()) { 676 FirstRun::IsChromeFirstRun()) {
675 return; 677 return;
676 } 678 }
677 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, 679 ChromeThread::PostTask(
678 new CheckDefaultBrowserTask(MessageLoop::current())); 680 ChromeThread::FILE, FROM_HERE, new CheckDefaultBrowserTask());
679 } 681 }
680 682
681 bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line, 683 bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line,
682 const std::wstring& cur_dir, 684 const std::wstring& cur_dir,
683 bool process_startup, 685 bool process_startup,
684 Profile* profile, 686 Profile* profile,
685 int* return_code, 687 int* return_code,
686 BrowserInit* browser_init) { 688 BrowserInit* browser_init) {
687 DCHECK(profile); 689 DCHECK(profile);
688 if (process_startup) { 690 if (process_startup) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 scoped_refptr<AutomationProviderClass> automation = 834 scoped_refptr<AutomationProviderClass> automation =
833 new AutomationProviderClass(profile); 835 new AutomationProviderClass(profile);
834 automation->ConnectToChannel(channel_id); 836 automation->ConnectToChannel(channel_id);
835 automation->SetExpectedTabCount(expected_tabs); 837 automation->SetExpectedTabCount(expected_tabs);
836 838
837 AutomationProviderList* list = 839 AutomationProviderList* list =
838 g_browser_process->InitAutomationProviderList(); 840 g_browser_process->InitAutomationProviderList();
839 DCHECK(list); 841 DCHECK(list);
840 list->AddProvider(automation); 842 list->AddProvider(automation);
841 } 843 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698