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

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: Address style/syntax comments Created 3 years, 12 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 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_H_
6 #define COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER_H_
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 // This does not implement WebUIMessageHandler or register its methods.
25 class PhysicalWebBaseMessageHandler {
26 public:
27 PhysicalWebBaseMessageHandler();
28 ~PhysicalWebBaseMessageHandler();
29
30 // This method handles the RequestNearbyURLs message, returning URLs that are
Eugene But (OOO till 7-30) 2016/12/22 21:26:32 Optional nit: How about s/This method handles/Hand
cco3 2016/12/22 22:07:07 Done.
31 // currently being broadcasted by Physical Web transports.
32 void HandleRequestNearbyURLs(const base::ListValue* args);
33
34 // This method handles a click on a Physical Web URL, recording the click and
Eugene But (OOO till 7-30) 2016/12/22 21:26:33 ditto
cco3 2016/12/22 22:07:07 Done.
35 // directing the user appropriately.
36 void HandlePhysicalWebItemClicked(const base::ListValue* args);
37
38 // Register the messages that this MessageHandler can handle.
Eugene But (OOO till 7-30) 2016/12/22 21:26:32 s/Register/Registers
cco3 2016/12/22 22:07:07 Done.
39 void RegisterMessages();
40
41 protected:
42 virtual void RegisterMessageCallback(
Eugene But (OOO till 7-30) 2016/12/22 21:26:32 Do you want to add comments for protected methods
cco3 2016/12/22 22:07:07 Done.
43 const std::string& message,
44 const MessageCallback& callback) = 0;
45 virtual void CallJavaScriptFunction(const std::string& function,
46 const base::Value& arg) = 0;
47 virtual physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() = 0;
48
49 private:
50 DISALLOW_COPY_AND_ASSIGN(PhysicalWebBaseMessageHandler);
51 };
52
53 } // namespace physical_web_ui
54
55 #endif // COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698