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.
5 #ifndef IOS_WEB_PUBLIC_WEB_UI_IOS_DATA_SOURCE_H_
6 #define IOS_WEB_PUBLIC_WEB_UI_IOS_DATA_SOURCE_H_
8 #include "base/callback.h"
9 #include "base/strings/string16.h"
10 #include "base/supports_user_data.h"
13 class DictionaryValue
;
14 class RefCountedMemory
;
20 // A data source that can help with implementing the common operations needed by
22 class WebUIIOSDataSource
: public base::SupportsUserData
{
24 ~WebUIIOSDataSource() override
{}
26 static WebUIIOSDataSource
* Create(const std::string
& source_name
);
28 // Adds a WebUIIOS data source to |browser_state|.
29 static void Add(BrowserState
* browser_state
, WebUIIOSDataSource
* source
);
31 // Adds a string keyed to its name to our dictionary.
32 virtual void AddString(const std::string
& name
,
33 const base::string16
& value
) = 0;
35 // Adds a string keyed to its name to our dictionary.
36 virtual void AddString(const std::string
& name
, const std::string
& value
) = 0;
38 // Adds a localized string with resource |ids| keyed to its name to our
40 virtual void AddLocalizedString(const std::string
& name
, int ids
) = 0;
42 // Adds a boolean keyed to its name to our dictionary.
43 virtual void AddBoolean(const std::string
& name
, bool value
) = 0;
45 // Sets the path which will return the JSON strings.
46 virtual void SetJsonPath(const std::string
& path
) = 0;
48 // Adds a mapping between a path name and a resource to return.
49 virtual void AddResourcePath(const std::string
& path
, int resource_id
) = 0;
51 // Sets the resource to returned when no other paths match.
52 virtual void SetDefaultResource(int resource_id
) = 0;
54 // The following map to methods on URLDataSource. See the documentation there.
55 virtual void DisableDenyXFrameOptions() = 0;
60 #endif // IOS_WEB_PUBLIC_WEB_UI_IOS_DATA_SOURCE_H_