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

Side by Side Diff: chrome/browser/ui/webui/welcome_win10_handler.cc

Issue 2722683002: Addressing UX regression on Win10 FRE, and changing timeout behavior (Closed)
Patch Set: adding todo Created 3 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
« no previous file with comments | « chrome/browser/resources/welcome/win10/inline.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/welcome_win10_handler.h" 5 #include "chrome/browser/ui/webui/welcome_win10_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram_functions.h" 8 #include "base/metrics/histogram_functions.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 bool callback_id_found = args->GetString(0, &pinned_state_callback_id_); 97 bool callback_id_found = args->GetString(0, &pinned_state_callback_id_);
98 DCHECK(callback_id_found); 98 DCHECK(callback_id_found);
99 99
100 // Send back the result if it is already available. 100 // Send back the result if it is already available.
101 if (pinned_state_result_.has_value()) { 101 if (pinned_state_result_.has_value()) {
102 SendPinnedToTaskbarStateResult(); 102 SendPinnedToTaskbarStateResult();
103 return; 103 return;
104 } 104 }
105 105
106 // Only wait for a small amount of time for the result. If the timer fires, 106 // Only wait for a small amount of time for the result. If the timer fires,
107 // it will be assumed that Chrome is pinned to the taskbar. This is to make 107 // it will be assumed that Chrome isn't pinned to the taskbar. This is to make
108 // sure the instructions are never displayed in case it was impossible to 108 // sure the instructions are displayed in case it was impossible to determine
109 // determine the pinned state. 109 // the pinned state.
110 constexpr base::TimeDelta kPinnedToTaskbarTimeout = 110 constexpr base::TimeDelta kPinnedToTaskbarTimeout =
111 base::TimeDelta::FromMilliseconds(200); 111 base::TimeDelta::FromMilliseconds(200);
112 timer_.Start(FROM_HERE, kPinnedToTaskbarTimeout, 112 timer_.Start(FROM_HERE, kPinnedToTaskbarTimeout,
113 base::Bind(&WelcomeWin10Handler::OnIsPinnedToTaskbarDetermined, 113 base::Bind(&WelcomeWin10Handler::OnIsPinnedToTaskbarDetermined,
114 base::Unretained(this), true, true)); 114 base::Unretained(this), true, false));
115 } 115 }
116 116
117 void WelcomeWin10Handler::HandleSetDefaultBrowser(const base::ListValue* args) { 117 void WelcomeWin10Handler::HandleSetDefaultBrowser(const base::ListValue* args) {
118 base::RecordAction( 118 base::RecordAction(
119 base::UserMetricsAction("Win10WelcomePage_SetAsDefaultBrowser")); 119 base::UserMetricsAction("Win10WelcomePage_SetAsDefaultBrowser"));
120 // The worker owns itself. 120 // The worker owns itself.
121 (new shell_integration::DefaultBrowserWorker( 121 (new shell_integration::DefaultBrowserWorker(
122 shell_integration::DefaultWebClientWorkerCallback())) 122 shell_integration::DefaultWebClientWorkerCallback()))
123 ->StartSetAsDefault(); 123 ->StartSetAsDefault();
124 } 124 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // sent back. 168 // sent back.
169 if (!pinned_state_callback_id_.empty()) 169 if (!pinned_state_callback_id_.empty())
170 SendPinnedToTaskbarStateResult(); 170 SendPinnedToTaskbarStateResult();
171 } 171 }
172 172
173 void WelcomeWin10Handler::SendPinnedToTaskbarStateResult() { 173 void WelcomeWin10Handler::SendPinnedToTaskbarStateResult() {
174 ResolveJavascriptCallback( 174 ResolveJavascriptCallback(
175 base::StringValue(pinned_state_callback_id_), 175 base::StringValue(pinned_state_callback_id_),
176 base::FundamentalValue(pinned_state_result_.value())); 176 base::FundamentalValue(pinned_state_result_.value()));
177 } 177 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/welcome/win10/inline.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698