Chromium Code Reviews| 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(content::WebUI* web_ui) {} | |
| 15 | |
| 16 WelcomeWin10Handler::~WelcomeWin10Handler() = default; | |
| 17 | |
| 18 void WelcomeWin10Handler::HandleSetDefaultBrowser(const base::ListValue* args) { | |
| 19 (new shell_integration::DefaultBrowserWorker( | |
| 20 shell_integration::DefaultWebClientWorkerCallback())) | |
| 21 ->StartSetAsDefault(); | |
| 22 } | |
| 23 | |
| 24 void WelcomeWin10Handler::HandleContinue(const base::ListValue* args) { | |
| 25 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.
| |
| 26 GURL(chrome::kChromeUINewTabURL), content::Referrer(), | |
| 27 ui::PageTransition::PAGE_TRANSITION_LINK, std::string()); | |
| 28 } | |
| 29 | |
| 30 // Override from WebUIMessageHandler. | |
| 31 void WelcomeWin10Handler::RegisterMessages() { | |
| 32 web_ui()->RegisterMessageCallback( | |
| 33 "handleSetDefaultBrowser", | |
| 34 base::Bind(&WelcomeWin10Handler::HandleSetDefaultBrowser, | |
| 35 base::Unretained(this))); | |
| 36 web_ui()->RegisterMessageCallback( | |
| 37 "handleContinue", | |
| 38 base::Bind(&WelcomeWin10Handler::HandleContinue, base::Unretained(this))); | |
| 39 } | |
| OLD | NEW |