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

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

Issue 2116673002: [ios] Moved WebUI provider code to ios/web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 4 years, 5 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_ 5 #ifndef IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_
6 #define IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_ 6 #define IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_
7 7
8 #include "base/strings/string16.h" 8 // TODO(crbug.com/524467): Remove this file once downstream code is switched to
9 9 // use correct header.
10 class GURL; 10 #include "ios/web/public/webui/web_ui_ios_message_handler.h"
11
12 namespace base {
13 class DictionaryValue;
14 class ListValue;
15 }
16
17 namespace web {
18
19 class WebUIIOS;
20 class WebUIIOSImpl;
21
22 // Messages sent from the DOM are forwarded via the WebUIIOS to handler
23 // classes. These objects are owned by WebUIIOS and destroyed when the
24 // host is destroyed.
25 class WebUIIOSMessageHandler {
26 public:
27 WebUIIOSMessageHandler() : web_ui_(NULL) {}
28 virtual ~WebUIIOSMessageHandler() {}
29
30 protected:
31 // Helper methods:
32
33 // Extract an integer value from a list Value.
34 static bool ExtractIntegerValue(const base::ListValue* value, int* out_int);
35
36 // Extract a floating point (double) value from a list Value.
37 static bool ExtractDoubleValue(const base::ListValue* value,
38 double* out_value);
39
40 // Extract a string value from a list Value.
41 static base::string16 ExtractStringValue(const base::ListValue* value);
42
43 // This is where subclasses specify which messages they'd like to handle and
44 // perform any additional initialization. At this point web_ui() will return
45 // the associated WebUIIOS object.
46 virtual void RegisterMessages() = 0;
47
48 // Returns the attached WebUIIOS for this handler.
49 WebUIIOS* web_ui() const { return web_ui_; }
50
51 // Sets the attached WebUIIOS - exposed to subclasses for testing purposes.
52 void set_web_ui(WebUIIOS* web_ui) { web_ui_ = web_ui; }
53
54 private:
55 // Provide external classes access to web_ui() and set_web_ui().
56 friend class WebUIIOSImpl;
57
58 WebUIIOS* web_ui_;
59 };
60
61 } // namespace web
62 11
63 #endif // IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_ 12 #endif // IOS_PUBLIC_PROVIDER_WEB_WEB_UI_IOS_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « ios/public/provider/web/web_ui_ios_controller_factory.h ('k') | ios/public/provider/web/web_ui_ios_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698