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

Side by Side Diff: ios/public/provider/web/web_ui_ios_message_handler.h

Issue 1110213002: Upstream most of the iOS WebUI support in ios/web/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 2014 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 IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_
6 #define IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_
7
8 #include "base/basictypes.h"
9 #include "base/strings/string16.h"
10
11 class GURL;
12
13 namespace base {
14 class DictionaryValue;
15 class ListValue;
16 }
17
18 namespace web {
19
20 class WebUIIOS;
21 class WebUIIOSImpl;
22
23 // Messages sent from the DOM are forwarded via the WebUIIOS to handler
24 // classes. These objects are owned by WebUIIOS and destroyed when the
25 // host is destroyed.
26 class WebUIIOSMessageHandler {
27 public:
28 WebUIIOSMessageHandler() : web_ui_(NULL) {}
29 virtual ~WebUIIOSMessageHandler() {}
30
31 protected:
32 // Helper methods:
33
34 // Extract an integer value from a list Value.
35 static bool ExtractIntegerValue(const base::ListValue* value, int* out_int);
36
37 // Extract a floating point (double) value from a list Value.
38 static bool ExtractDoubleValue(const base::ListValue* value,
39 double* out_value);
40
41 // Extract a string value from a list Value.
42 static base::string16 ExtractStringValue(const base::ListValue* value);
43
44 // This is where subclasses specify which messages they'd like to handle and
45 // perform any additional initialization. At this point web_ui() will return
46 // the associated WebUIIOS object.
47 virtual void RegisterMessages() = 0;
48
49 // Returns the attached WebUIIOS for this handler.
50 WebUIIOS* web_ui() const { return web_ui_; }
51
52 // Sets the attached WebUIIOS - exposed to subclasses for testing purposes.
53 void set_web_ui(WebUIIOS* web_ui) { web_ui_ = web_ui; }
54
55 private:
56 // Provide external classes access to web_ui() and set_web_ui().
57 friend class WebUIIOSImpl;
58
59 WebUIIOS* web_ui_;
60 };
61
62 } // namespace web
63
64 #endif // IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698