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

Side by Side Diff: components/physical_web/webui/physical_web_base_message_handler.h

Issue 2571853003: Move PW message handler logic to components (Closed)
Patch Set: Limit ourselves to the sadness that is single inheritance Created 4 years 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 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 #ifndef COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER
Eugene But (OOO till 7-30) 2016/12/22 19:04:47 COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_ME
cco3 2016/12/22 20:14:45 Done.
6 #define COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/values.h"
11
12 namespace physical_web {
13
14 class PhysicalWebDataSource;
15
16 } // namespace physical_web
17
18 namespace physical_web_ui {
19
20 // This is the equivalent of content::WebUI::MessageCallback.
21 typedef base::Callback<void(const base::ListValue*)> MessageCallback;
22
23 // The base handler for Javascript messages for the chrome://physical-web page.
24 // (Does not implement WebUIMessageHandler or register its methods)
Eugene But (OOO till 7-30) 2016/12/22 19:04:47 nit: Please finish comment with full stop
cco3 2016/12/22 20:14:45 Done.
25 class PhysicalWebBaseMessageHandler {
26 public:
27 PhysicalWebBaseMessageHandler();
28 ~PhysicalWebBaseMessageHandler();
29
30 void HandleRequestNearbyURLs(const base::ListValue* args);
Eugene But (OOO till 7-30) 2016/12/22 19:04:47 Please add comments to the methods. https://engdo
cco3 2016/12/22 20:14:45 Done.
31 void HandlePhysicalWebItemClicked(const base::ListValue* args);
32
33 protected:
34 void RegisterMessagesImpl();
Eugene But (OOO till 7-30) 2016/12/22 19:04:47 Should this function be protected or private?
Eugene But (OOO till 7-30) 2016/12/22 19:04:47 nit: Do you need an Impl suffix here?
cco3 2016/12/22 20:14:45 Not any more.
cco3 2016/12/22 20:14:45 Done.
35 virtual void RegisterMessageCallback(
36 const std::string& message,
37 const MessageCallback& callback) = 0;
38 virtual void CallJavaScriptFunction(const std::string& function,
39 const base::Value& arg) = 0;
40 virtual physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() = 0;
Eugene But (OOO till 7-30) 2016/12/22 19:04:47 Should this be a const method?
cco3 2016/12/22 20:14:45 Done.
Eugene But (OOO till 7-30) 2016/12/22 21:26:32 Sorry, I meant "const method", which is: virtual p
41
42 private:
43 DISALLOW_COPY_AND_ASSIGN(PhysicalWebBaseMessageHandler);
44 };
45
46 } // namespace physical_web_ui
47
48 #endif // COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698