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

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

Issue 200025: Allow the default browser check to return "unknown" and reflect that in the UI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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) 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/shell_integration.h" 5 #include "chrome/browser/shell_integration.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 26 matching lines...) Expand all
37 // Our associated view has gone away, so we shouldn't call back to it if 37 // Our associated view has gone away, so we shouldn't call back to it if
38 // our worker thread returns after the view is dead. 38 // our worker thread returns after the view is dead.
39 observer_ = NULL; 39 observer_ = NULL;
40 } 40 }
41 41
42 /////////////////////////////////////////////////////////////////////////////// 42 ///////////////////////////////////////////////////////////////////////////////
43 // DefaultBrowserWorker, private: 43 // DefaultBrowserWorker, private:
44 44
45 void ShellIntegration::DefaultBrowserWorker::ExecuteCheckDefaultBrowser() { 45 void ShellIntegration::DefaultBrowserWorker::ExecuteCheckDefaultBrowser() {
46 DCHECK(MessageLoop::current() == file_loop_); 46 DCHECK(MessageLoop::current() == file_loop_);
47 bool is_default = ShellIntegration::IsDefaultBrowser(); 47 DefaultBrowserState state = ShellIntegration::IsDefaultBrowser();
48 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, 48 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
49 &DefaultBrowserWorker::CompleteCheckDefaultBrowser, is_default)); 49 &DefaultBrowserWorker::CompleteCheckDefaultBrowser, state));
50 } 50 }
51 51
52 void ShellIntegration::DefaultBrowserWorker::CompleteCheckDefaultBrowser( 52 void ShellIntegration::DefaultBrowserWorker::CompleteCheckDefaultBrowser(
53 bool is_default) { 53 DefaultBrowserState state) {
54 DCHECK(MessageLoop::current() == ui_loop_); 54 DCHECK(MessageLoop::current() == ui_loop_);
55 UpdateUI(is_default); 55 UpdateUI(state);
56 } 56 }
57 57
58 void ShellIntegration::DefaultBrowserWorker::ExecuteSetAsDefaultBrowser() { 58 void ShellIntegration::DefaultBrowserWorker::ExecuteSetAsDefaultBrowser() {
59 DCHECK(MessageLoop::current() == file_loop_); 59 DCHECK(MessageLoop::current() == file_loop_);
60 ShellIntegration::SetAsDefaultBrowser(); 60 ShellIntegration::SetAsDefaultBrowser();
61 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, 61 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
62 &DefaultBrowserWorker::CompleteSetAsDefaultBrowser)); 62 &DefaultBrowserWorker::CompleteSetAsDefaultBrowser));
63 } 63 }
64 64
65 void ShellIntegration::DefaultBrowserWorker::CompleteSetAsDefaultBrowser() { 65 void ShellIntegration::DefaultBrowserWorker::CompleteSetAsDefaultBrowser() {
66 DCHECK(MessageLoop::current() == ui_loop_); 66 DCHECK(MessageLoop::current() == ui_loop_);
67 if (observer_) { 67 if (observer_) {
68 // Set as default completed, check again to make sure it stuck... 68 // Set as default completed, check again to make sure it stuck...
69 StartCheckDefaultBrowser(); 69 StartCheckDefaultBrowser();
70 } 70 }
71 } 71 }
72 72
73 void ShellIntegration::DefaultBrowserWorker::UpdateUI(bool is_default) { 73 void ShellIntegration::DefaultBrowserWorker::UpdateUI(
74 DefaultBrowserState state) {
74 if (observer_) { 75 if (observer_) {
75 DefaultBrowserUIState state = 76 switch (state) {
76 is_default ? STATE_DEFAULT : STATE_NOT_DEFAULT; 77 case NOT_DEFAULT_BROWSER:
77 observer_->SetDefaultBrowserUIState(state); 78 observer_->SetDefaultBrowserUIState(STATE_NOT_DEFAULT);
79 break;
80 case IS_DEFAULT_BROWSER:
81 observer_->SetDefaultBrowserUIState(STATE_IS_DEFAULT);
82 break;
83 case UNKNOWN_DEFAULT_BROWSER:
84 observer_->SetDefaultBrowserUIState(STATE_UNKNOWN);
85 break;
86 default:
87 break;
88 }
78 } 89 }
79 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698