| OLD | NEW |
| 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/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 std::string histogram_suffix; | 57 std::string histogram_suffix; |
| 58 histogram_suffix += inline_style_variant_ ? "Inline" : "Sectioned"; | 58 histogram_suffix += inline_style_variant_ ? "Inline" : "Sectioned"; |
| 59 histogram_suffix += pin_instructions_shown ? "Combined" : "Default"; | 59 histogram_suffix += pin_instructions_shown ? "Combined" : "Default"; |
| 60 | 60 |
| 61 // Closing the page. Record whether the instructions were useful. | 61 // Closing the page. Record whether the instructions were useful. |
| 62 (new shell_integration::DefaultBrowserWorker( | 62 (new shell_integration::DefaultBrowserWorker( |
| 63 base::Bind(&RecordDefaultBrowserResult, histogram_suffix))) | 63 base::Bind(&RecordDefaultBrowserResult, histogram_suffix))) |
| 64 ->StartCheckIsDefault(); | 64 ->StartCheckIsDefault(); |
| 65 | 65 |
| 66 if (pin_instructions_shown) { | 66 if (pin_instructions_shown) { |
| 67 // On error, call RecordPinnedResult() with |succeeded| == false. |
| 68 base::Closure error_callback = |
| 69 base::Bind(&RecordPinnedResult, histogram_suffix, false, false); |
| 67 shell_integration::win::GetIsPinnedToTaskbarState( | 70 shell_integration::win::GetIsPinnedToTaskbarState( |
| 68 base::Closure(), base::Bind(&RecordPinnedResult, histogram_suffix)); | 71 error_callback, base::Bind(&RecordPinnedResult, histogram_suffix)); |
| 69 } | 72 } |
| 70 } | 73 } |
| 71 | 74 |
| 72 void WelcomeWin10Handler::RegisterMessages() { | 75 void WelcomeWin10Handler::RegisterMessages() { |
| 73 web_ui()->RegisterMessageCallback( | 76 web_ui()->RegisterMessageCallback( |
| 74 "handleSetDefaultBrowser", | 77 "handleSetDefaultBrowser", |
| 75 base::Bind(&WelcomeWin10Handler::HandleSetDefaultBrowser, | 78 base::Bind(&WelcomeWin10Handler::HandleSetDefaultBrowser, |
| 76 base::Unretained(this))); | 79 base::Unretained(this))); |
| 77 web_ui()->RegisterMessageCallback( | 80 web_ui()->RegisterMessageCallback( |
| 78 "handleContinue", | 81 "handleContinue", |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // sent back. | 164 // sent back. |
| 162 if (!pinned_state_callback_id_.empty()) | 165 if (!pinned_state_callback_id_.empty()) |
| 163 SendPinnedToTaskbarStateResult(); | 166 SendPinnedToTaskbarStateResult(); |
| 164 } | 167 } |
| 165 | 168 |
| 166 void WelcomeWin10Handler::SendPinnedToTaskbarStateResult() { | 169 void WelcomeWin10Handler::SendPinnedToTaskbarStateResult() { |
| 167 ResolveJavascriptCallback( | 170 ResolveJavascriptCallback( |
| 168 base::StringValue(pinned_state_callback_id_), | 171 base::StringValue(pinned_state_callback_id_), |
| 169 base::FundamentalValue(pinned_state_result_.value())); | 172 base::FundamentalValue(pinned_state_result_.value())); |
| 170 } | 173 } |
| OLD | NEW |