OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/welcome_win10_handler.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/bind.h" |
| 10 #include "chrome/browser/shell_integration.h" |
| 11 #include "chrome/common/url_constants.h" |
| 12 #include "content/public/browser/web_contents.h" |
| 13 |
| 14 WelcomeWin10Handler::WelcomeWin10Handler() = default; |
| 15 |
| 16 WelcomeWin10Handler::~WelcomeWin10Handler() = default; |
| 17 |
| 18 // Override from WebUIMessageHandler. |
| 19 void WelcomeWin10Handler::RegisterMessages() { |
| 20 web_ui()->RegisterMessageCallback( |
| 21 "handleSetDefaultBrowser", |
| 22 base::Bind(&WelcomeWin10Handler::HandleSetDefaultBrowser, |
| 23 base::Unretained(this))); |
| 24 web_ui()->RegisterMessageCallback( |
| 25 "handleContinue", |
| 26 base::Bind(&WelcomeWin10Handler::HandleContinue, base::Unretained(this))); |
| 27 } |
| 28 |
| 29 void WelcomeWin10Handler::HandleSetDefaultBrowser(const base::ListValue* args) { |
| 30 // The worker owns itself. |
| 31 (new shell_integration::DefaultBrowserWorker( |
| 32 shell_integration::DefaultWebClientWorkerCallback())) |
| 33 ->StartSetAsDefault(); |
| 34 } |
| 35 |
| 36 void WelcomeWin10Handler::HandleContinue(const base::ListValue* args) { |
| 37 web_ui()->GetWebContents()->GetController().LoadURL( |
| 38 GURL(chrome::kChromeUINewTabURL), content::Referrer(), |
| 39 ui::PageTransition::PAGE_TRANSITION_LINK, std::string()); |
| 40 } |
OLD | NEW |