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

Side by Side Diff: extensions/common/manifest_handlers/webview_info.h

Issue 1312653003: Fix for WebView accessible resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments by kalman@. Created 5 years, 3 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 EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "extensions/common/extension.h" 11 #include "extensions/common/extension.h"
12 #include "extensions/common/manifest_handler.h" 12 #include "extensions/common/manifest_handler.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 class PartitionItem; 16 class PartitionItem;
17 17
18 // A class to hold the <webview> accessible extension resources 18 // A class to hold the <webview> accessible extension resources
19 // that may be specified in the manifest of an extension using the 19 // that may be specified in the manifest of an extension using the
20 // "webview" key. 20 // "webview" key.
21 class WebviewInfo : public Extension::ManifestData { 21 class WebviewInfo : public Extension::ManifestData {
22 public: 22 public:
23 // Get the WebviewInfo from |extension|'s manifest.
24 static const WebviewInfo* Get(const Extension* extension);
25
23 // Define out of line constructor/destructor to please Clang. 26 // Define out of line constructor/destructor to please Clang.
24 WebviewInfo(const std::string& extension_id); 27 WebviewInfo(const std::string& extension_id);
25 ~WebviewInfo() override; 28 ~WebviewInfo() override;
26 29
27 // Returns true if the specified resource is web accessible and the extension 30 // Returns true if the specified resource is web accessible and the extension
28 // matches the manifest's extension. 31 // matches the manifest's extension.
29 bool IsResourceWebviewAccessible(const Extension* extension, 32 bool IsResourceWebviewAccessible(const Extension* extension,
not at google - send to devlin 2015/09/03 20:17:54 you know, it's actually silly that this isn't stat
paulmeyer 2015/09/08 18:51:36 I'll make it static, but I can keep the Get() func
not at google - send to devlin 2015/09/08 20:10:24 If the only caller is IsResourceWebviewAccessible
30 const std::string& partition_id, 33 const std::string& partition_id,
31 const std::string& relative_path) const; 34 const std::string& relative_path) const;
32 35
33 void AddPartitionItem(scoped_ptr<PartitionItem> item); 36 void AddPartitionItem(scoped_ptr<PartitionItem> item);
34 37
35 private: 38 private:
36 std::string extension_id_; 39 std::string extension_id_;
37 ScopedVector<PartitionItem> partition_items_; 40 ScopedVector<PartitionItem> partition_items_;
38 }; 41 };
39 42
40 // Parses the "webview" manifest key. 43 // Parses the "webview" manifest key.
41 class WebviewHandler : public ManifestHandler { 44 class WebviewHandler : public ManifestHandler {
42 public: 45 public:
43 WebviewHandler(); 46 WebviewHandler();
44 ~WebviewHandler() override; 47 ~WebviewHandler() override;
45 48
46 bool Parse(Extension* extension, base::string16* error) override; 49 bool Parse(Extension* extension, base::string16* error) override;
47 50
48 private: 51 private:
49 const std::vector<std::string> Keys() const override; 52 const std::vector<std::string> Keys() const override;
50 53
51 DISALLOW_COPY_AND_ASSIGN(WebviewHandler); 54 DISALLOW_COPY_AND_ASSIGN(WebviewHandler);
52 }; 55 };
53 56
54 } // namespace extensions 57 } // namespace extensions
55 58
56 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ 59 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698