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

Unified Diff: chrome/browser/shell_integration.cc

Issue 1657933003: Fixes the interactive default browser UX for policy setting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge issue Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/shell_integration.h ('k') | chrome/browser/ui/apps/chrome_app_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/shell_integration.cc
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 1ed340bb6627f3aaa6c5625ed2fb47d07cbb4594..eaca74626bee6683a57cd65e06f0af225f26a66b 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -147,24 +147,13 @@ base::string16 GetAppShortcutsSubdirName() {
#endif // !defined(OS_WIN)
///////////////////////////////////////////////////////////////////////////////
-// DefaultWebClientObserver
-//
-
-bool DefaultWebClientObserver::IsOwnedByWorker() {
- return false;
-}
-
-bool DefaultWebClientObserver::IsInteractiveSetDefaultPermitted() {
- return false;
-}
-
-///////////////////////////////////////////////////////////////////////////////
// DefaultWebClientWorker
//
DefaultWebClientWorker::DefaultWebClientWorker(
- DefaultWebClientObserver* observer)
- : observer_(observer) {}
+ DefaultWebClientObserver* observer,
+ bool delete_observer)
+ : observer_(observer), delete_observer_(delete_observer) {}
void DefaultWebClientWorker::StartCheckIsDefault() {
if (observer_)
@@ -187,20 +176,17 @@ void DefaultWebClientWorker::StartSetAsDefault() {
}
set_as_default_in_progress_ = true;
- bool interactive_permitted = true;
- if (observer_) {
+ if (observer_)
observer_->SetDefaultWebClientUIState(STATE_PROCESSING);
- interactive_permitted = observer_->IsInteractiveSetDefaultPermitted();
- }
set_as_default_initialized_ = InitializeSetAsDefault();
// Remember the start time.
start_time_ = base::TimeTicks::Now();
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- base::Bind(&DefaultWebClientWorker::SetAsDefault,
- this, interactive_permitted));
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&DefaultWebClientWorker::SetAsDefault, this));
}
void DefaultWebClientWorker::ObserverDestroyed() {
@@ -238,7 +224,7 @@ void DefaultWebClientWorker::OnCheckIsDefaultComplete(
// The worker has finished everything it needs to do, so free the observer
// if we own it.
- if (observer_ && observer_->IsOwnedByWorker()) {
+ if (observer_ && delete_observer_) {
delete observer_;
observer_ = nullptr;
}
@@ -363,8 +349,9 @@ const char* DefaultWebClientWorker::AttemptResultToString(
// DefaultBrowserWorker
//
-DefaultBrowserWorker::DefaultBrowserWorker(DefaultWebClientObserver* observer)
- : DefaultWebClientWorker(observer) {}
+DefaultBrowserWorker::DefaultBrowserWorker(DefaultWebClientObserver* observer,
+ bool delete_observer)
+ : DefaultWebClientWorker(observer, delete_observer) {}
DefaultBrowserWorker::~DefaultBrowserWorker() {}
@@ -378,7 +365,7 @@ void DefaultBrowserWorker::CheckIsDefault() {
base::Bind(&DefaultBrowserWorker::OnCheckIsDefaultComplete, this, state));
}
-void DefaultBrowserWorker::SetAsDefault(bool interactive_permitted) {
+void DefaultBrowserWorker::SetAsDefault() {
AttemptResult result = AttemptResult::FAILURE;
switch (CanSetAsDefaultBrowser()) {
case SET_DEFAULT_NOT_ALLOWED:
@@ -389,12 +376,12 @@ void DefaultBrowserWorker::SetAsDefault(bool interactive_permitted) {
result = AttemptResult::SUCCESS;
break;
case SET_DEFAULT_INTERACTIVE:
- if (interactive_permitted && SetAsDefaultBrowserInteractive())
+ if (interactive_permitted_ && SetAsDefaultBrowserInteractive())
result = AttemptResult::SUCCESS;
break;
case SET_DEFAULT_ASYNCHRONOUS:
#if defined(OS_WIN)
- if (!interactive_permitted)
+ if (!interactive_permitted_)
break;
if (GetDefaultBrowser() == IS_DEFAULT) {
// Don't start the asynchronous operation since it could result in
@@ -430,8 +417,9 @@ const char* DefaultBrowserWorker::GetHistogramPrefix() {
DefaultProtocolClientWorker::DefaultProtocolClientWorker(
DefaultWebClientObserver* observer,
- const std::string& protocol)
- : DefaultWebClientWorker(observer), protocol_(protocol) {}
+ const std::string& protocol,
+ bool delete_observer)
+ : DefaultWebClientWorker(observer, delete_observer), protocol_(protocol) {}
///////////////////////////////////////////////////////////////////////////////
// DefaultProtocolClientWorker, private:
@@ -446,7 +434,7 @@ void DefaultProtocolClientWorker::CheckIsDefault() {
state));
}
-void DefaultProtocolClientWorker::SetAsDefault(bool interactive_permitted) {
+void DefaultProtocolClientWorker::SetAsDefault() {
AttemptResult result = AttemptResult::FAILURE;
switch (CanSetAsDefaultProtocolClient()) {
case SET_DEFAULT_NOT_ALLOWED:
@@ -457,7 +445,7 @@ void DefaultProtocolClientWorker::SetAsDefault(bool interactive_permitted) {
result = AttemptResult::SUCCESS;
break;
case SET_DEFAULT_INTERACTIVE:
- if (interactive_permitted &&
+ if (interactive_permitted_ &&
SetAsDefaultProtocolClientInteractive(protocol_)) {
result = AttemptResult::SUCCESS;
}
« no previous file with comments | « chrome/browser/shell_integration.h ('k') | chrome/browser/ui/apps/chrome_app_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698