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

Side by Side Diff: chrome/browser/ui/webui/settings/settings_default_browser_handler.cc

Issue 1748773002: Simplify the default browser infobar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/webui/settings/settings_default_browser_handler.h" 5 #include "chrome/browser/ui/webui/settings/settings_default_browser_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/ui/startup/default_browser_prompt.h"
9 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
10 #include "components/prefs/pref_service.h" 11 #include "components/prefs/pref_service.h"
11 #include "content/public/browser/web_ui.h" 12 #include "content/public/browser/web_ui.h"
12 13
13 namespace settings { 14 namespace settings {
14 15
15 namespace { 16 namespace {
16 17
17 bool IsDisabledByPolicy(const BooleanPrefMember& pref) { 18 bool IsDisabledByPolicy(const BooleanPrefMember& pref) {
18 return pref.IsManaged() && !pref.GetValue(); 19 return pref.IsManaged() && !pref.GetValue();
(...skipping 27 matching lines...) Expand all
46 } 47 }
47 48
48 void DefaultBrowserHandler::SetDefaultWebClientUIState( 49 void DefaultBrowserHandler::SetDefaultWebClientUIState(
49 shell_integration::DefaultWebClientUIState state) { 50 shell_integration::DefaultWebClientUIState state) {
50 if (state == shell_integration::STATE_PROCESSING) 51 if (state == shell_integration::STATE_PROCESSING)
51 return; 52 return;
52 53
53 if (state == shell_integration::STATE_IS_DEFAULT) { 54 if (state == shell_integration::STATE_IS_DEFAULT) {
54 // Notify the user in the future if Chrome ceases to be the user's chosen 55 // Notify the user in the future if Chrome ceases to be the user's chosen
55 // default browser. 56 // default browser.
56 Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean( 57 chrome::ResetDefaultBrowserPrompt(Profile::FromWebUI(web_ui()));
57 prefs::kCheckDefaultBrowser, true);
58 } 58 }
59 59
60 base::FundamentalValue is_default(state == 60 base::FundamentalValue is_default(state ==
61 shell_integration::STATE_IS_DEFAULT); 61 shell_integration::STATE_IS_DEFAULT);
62 base::FundamentalValue can_be_default( 62 base::FundamentalValue can_be_default(
63 state != shell_integration::STATE_UNKNOWN && 63 state != shell_integration::STATE_UNKNOWN &&
64 !IsDisabledByPolicy(default_browser_policy_) && 64 !IsDisabledByPolicy(default_browser_policy_) &&
65 shell_integration::CanSetAsDefaultBrowser() != 65 shell_integration::CanSetAsDefaultBrowser() !=
66 shell_integration::SET_DEFAULT_NOT_ALLOWED); 66 shell_integration::SET_DEFAULT_NOT_ALLOWED);
67 67
68 web_ui()->CallJavascriptFunction("Settings.updateDefaultBrowserState", 68 web_ui()->CallJavascriptFunction("Settings.updateDefaultBrowserState",
69 is_default, can_be_default); 69 is_default, can_be_default);
70 } 70 }
71 71
72 void DefaultBrowserHandler::RequestDefaultBrowserState( 72 void DefaultBrowserHandler::RequestDefaultBrowserState(
73 const base::ListValue* /*args*/) { 73 const base::ListValue* /*args*/) {
74 default_browser_worker_->StartCheckIsDefault(); 74 default_browser_worker_->StartCheckIsDefault();
75 } 75 }
76 76
77 void DefaultBrowserHandler::SetAsDefaultBrowser(const base::ListValue* args) { 77 void DefaultBrowserHandler::SetAsDefaultBrowser(const base::ListValue* args) {
78 CHECK(!IsDisabledByPolicy(default_browser_policy_)); 78 CHECK(!IsDisabledByPolicy(default_browser_policy_));
79 79
80 default_browser_worker_->StartSetAsDefault(); 80 default_browser_worker_->StartSetAsDefault();
81 81
82 // If the user attempted to make Chrome the default browser, notify 82 // If the user attempted to make Chrome the default browser, notify
83 // them when this changes. 83 // them when this changes.
84 Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean( 84 chrome::ResetDefaultBrowserPrompt(Profile::FromWebUI(web_ui()));
85 prefs::kCheckDefaultBrowser, true);
86 } 85 }
87 86
88 } // namespace settings 87 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698