| 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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "chrome/browser/shell_integration.h" | 9 #include "chrome/browser/shell_integration.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 void WelcomeWin10Handler::HandleContinue(const base::ListValue* args) { | 71 void WelcomeWin10Handler::HandleContinue(const base::ListValue* args) { |
| 72 web_ui()->GetWebContents()->GetController().LoadURL( | 72 web_ui()->GetWebContents()->GetController().LoadURL( |
| 73 GURL(chrome::kChromeUINewTabURL), content::Referrer(), | 73 GURL(chrome::kChromeUINewTabURL), content::Referrer(), |
| 74 ui::PageTransition::PAGE_TRANSITION_LINK, std::string()); | 74 ui::PageTransition::PAGE_TRANSITION_LINK, std::string()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void WelcomeWin10Handler::StartIsPinnedToTaskbarCheck() { | 77 void WelcomeWin10Handler::StartIsPinnedToTaskbarCheck() { |
| 78 // Start the utility process that will handle the IsPinnedToTaskbar() call. | 78 // Start the utility process that will handle the IsPinnedToTaskbar() call. |
| 79 client_ = | 79 client_ = base::MakeUnique< |
| 80 base::MakeUnique<content::UtilityProcessMojoClient<mojom::ShellHandler>>( | 80 content::UtilityProcessMojoClient<chrome::mojom::ShellHandler>>( |
| 81 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_SHELL_HANDLER_NAME)); | 81 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_SHELL_HANDLER_NAME)); |
| 82 | 82 |
| 83 // Assume that Chrome is pinned to the taskbar if an error occurs. | 83 // Assume that Chrome is pinned to the taskbar if an error occurs. |
| 84 client_->set_error_callback( | 84 client_->set_error_callback( |
| 85 base::Bind(&WelcomeWin10Handler::OnIsPinnedToTaskbarDetermined, | 85 base::Bind(&WelcomeWin10Handler::OnIsPinnedToTaskbarDetermined, |
| 86 base::Unretained(this), true)); | 86 base::Unretained(this), true)); |
| 87 client_->set_disable_sandbox(); | 87 client_->set_disable_sandbox(); |
| 88 client_->Start(); | 88 client_->Start(); |
| 89 | 89 |
| 90 client_->service()->IsPinnedToTaskbar(base::Bind( | 90 client_->service()->IsPinnedToTaskbar(base::Bind( |
| 91 &WelcomeWin10Handler::OnIsPinnedToTaskbarResult, base::Unretained(this))); | 91 &WelcomeWin10Handler::OnIsPinnedToTaskbarResult, base::Unretained(this))); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 // sent back. | 111 // sent back. |
| 112 if (!pinned_state_callback_id_.empty()) | 112 if (!pinned_state_callback_id_.empty()) |
| 113 SendPinnedToTaskbarStateResult(); | 113 SendPinnedToTaskbarStateResult(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void WelcomeWin10Handler::SendPinnedToTaskbarStateResult() { | 116 void WelcomeWin10Handler::SendPinnedToTaskbarStateResult() { |
| 117 ResolveJavascriptCallback( | 117 ResolveJavascriptCallback( |
| 118 base::StringValue(pinned_state_callback_id_), | 118 base::StringValue(pinned_state_callback_id_), |
| 119 base::FundamentalValue(pinned_state_result_.value())); | 119 base::FundamentalValue(pinned_state_result_.value())); |
| 120 } | 120 } |
| OLD | NEW |