Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: chrome/browser/ui/webui/webapks_handler.cc

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Adds comment to explain the reason of an empty param Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017 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/webapks_handler.h"
6
7 #include "base/callback_forward.h"
8 #include "chrome/browser/android/shortcut_helper.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/webui/webapk_info_callback.h"
11 #include "chrome/grit/generated_resources.h"
12 #include "components/strings/grit/components_strings.h"
13 #include "components/webapks_ui/webapks_ui_constants.h"
14 #include "content/public/browser/web_ui.h"
15
16 WebApksHandler::WebApksHandler() : weak_ptr_factory_(this) {}
17
18 WebApksHandler::~WebApksHandler() {}
19
20 void WebApksHandler::RegisterMessages() {
21 web_ui()->RegisterMessageCallback(
22 webapks_ui::kRequestWebApksInfo,
23 base::Bind(&WebApksHandler::HandleRequestWebApksInfo,
24 base::Unretained(this)));
25 }
26
27 void WebApksHandler::HandleRequestWebApksInfo(const base::ListValue* args) {
28 base::RepeatingCallback<void(std::string, std::string, int, int)> callback =
29 base::BindRepeating(&WebApksHandler::OnWebApkInfoReceived,
30 weak_ptr_factory_.GetWeakPtr());
Xi Han 2017/01/16 16:56:19 Please add a commend here: "WebApkInfoCallback wil
gonzalon 2017/01/16 19:50:44 Done.
31 WebApkInfoCallback* webapk_info_callback = new WebApkInfoCallback(callback);
32 webapk_info_callback->MakeInfoRequest(base::android::AttachCurrentThread());
33 }
34
35 void WebApksHandler::OnWebApkInfoReceived(std::string name,
36 std::string package_name,
37 int shell_apk_version,
38 int version_code) {
39 base::StringValue name_value(name);
40 base::StringValue package_name_value(package_name);
41 base::FundamentalValue shell_apk_version_value(shell_apk_version);
42 base::FundamentalValue version_code_value(version_code);
43 web_ui()->CallJavascriptFunctionUnsafe(
44 webapks_ui::kReturnWebApksInfo, name_value, package_name_value,
45 shell_apk_version_value, version_code_value);
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698