Chromium Code Reviews| Index: chrome/browser/ui/webui/welcome_win10_handler.cc |
| diff --git a/chrome/browser/ui/webui/welcome_win10_handler.cc b/chrome/browser/ui/webui/welcome_win10_handler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..298b67ece81a91a7fda1b050243dba005470b39c |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/welcome_win10_handler.cc |
| @@ -0,0 +1,39 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/webui/welcome_win10_handler.h" |
| + |
| +#include <string> |
| + |
| +#include "base/bind.h" |
| +#include "chrome/browser/shell_integration.h" |
| +#include "chrome/common/url_constants.h" |
| +#include "content/public/browser/web_contents.h" |
| + |
| +WelcomeWin10Handler::WelcomeWin10Handler(content::WebUI* web_ui) {} |
| + |
| +WelcomeWin10Handler::~WelcomeWin10Handler() = default; |
| + |
| +void WelcomeWin10Handler::HandleSetDefaultBrowser(const base::ListValue* args) { |
| + (new shell_integration::DefaultBrowserWorker( |
| + shell_integration::DefaultWebClientWorkerCallback())) |
| + ->StartSetAsDefault(); |
| +} |
| + |
| +void WelcomeWin10Handler::HandleContinue(const base::ListValue* args) { |
| + web_ui()->GetWebContents()->GetController().LoadURL( |
|
tmartino
2016/10/12 22:06:40
Why use LoadURL instead of Navigate?
https://cs.c
Patrick Monette
2016/10/13 21:30:05
The chrome::Navigate() function is the generalized
tmartino
2016/10/14 19:32:09
Noted, will change in tech debt phase.
|
| + GURL(chrome::kChromeUINewTabURL), content::Referrer(), |
| + ui::PageTransition::PAGE_TRANSITION_LINK, std::string()); |
| +} |
| + |
| +// Override from WebUIMessageHandler. |
| +void WelcomeWin10Handler::RegisterMessages() { |
| + web_ui()->RegisterMessageCallback( |
| + "handleSetDefaultBrowser", |
| + base::Bind(&WelcomeWin10Handler::HandleSetDefaultBrowser, |
| + base::Unretained(this))); |
| + web_ui()->RegisterMessageCallback( |
| + "handleContinue", |
| + base::Bind(&WelcomeWin10Handler::HandleContinue, base::Unretained(this))); |
| +} |