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

Unified Diff: chrome/browser/ui/startup/default_browser_prompt.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
Index: chrome/browser/ui/startup/default_browser_prompt.cc
diff --git a/chrome/browser/ui/startup/default_browser_prompt.cc b/chrome/browser/ui/startup/default_browser_prompt.cc
index d4f57eb34523522d26ba0911cf7a90608fd6b78f..832f36dd5b7c9692b974f5ccb3739e491148aff8 100644
--- a/chrome/browser/ui/startup/default_browser_prompt.cc
+++ b/chrome/browser/ui/startup/default_browser_prompt.cc
@@ -176,8 +176,12 @@ bool DefaultBrowserInfoBarDelegate::Accept() {
UMA_HISTOGRAM_ENUMERATION("DefaultBrowser.InfoBar.UserInteraction",
InfoBarUserInteraction::START_SET_AS_DEFAULT,
NUM_INFO_BAR_USER_INTERACTION_TYPES);
+ // The worker pointer is reference counted. While it is running, the
+ // message loops of the FILE and UI thread will hold references to it
+ // and it will be automatically freed once all its tasks have finished.
scoped_refptr<shell_integration::DefaultBrowserWorker>(
- new shell_integration::DefaultBrowserWorker(nullptr))
+ new shell_integration::DefaultBrowserWorker(nullptr,
+ /*delete_observer=*/false))
->StartSetAsDefault();
return true;
}
@@ -208,7 +212,6 @@ class CheckDefaultBrowserObserver
private:
void SetDefaultWebClientUIState(
shell_integration::DefaultWebClientUIState state) override;
- bool IsOwnedByWorker() override;
void ResetCheckDefaultBrowserPref();
void ShowPrompt();
@@ -242,11 +245,6 @@ void CheckDefaultBrowserObserver::SetDefaultWebClientUIState(
}
}
-bool CheckDefaultBrowserObserver::IsOwnedByWorker() {
- // Instruct the DefaultBrowserWorker to delete this instance when it is done.
- return true;
-}
-
void CheckDefaultBrowserObserver::ResetCheckDefaultBrowserPref() {
Profile* profile =
g_browser_process->profile_manager()->GetProfileByPath(profile_path_);
@@ -317,7 +315,8 @@ void ShowDefaultBrowserPrompt(Profile* profile) {
scoped_refptr<shell_integration::DefaultBrowserWorker>(
new shell_integration::DefaultBrowserWorker(
- new CheckDefaultBrowserObserver(profile->GetPath(), show_prompt)))
+ new CheckDefaultBrowserObserver(profile->GetPath(), show_prompt),
+ /*delete_observer=*/true))
->StartCheckIsDefault();
}
« no previous file with comments | « chrome/browser/ui/apps/chrome_app_delegate.cc ('k') | chrome/browser/ui/webui/options/browser_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698