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

Side by Side Diff: chrome/browser/extensions/external_pref_extension_loader.h

Issue 7718021: Add external extensions json source in proper mac location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rev Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_EXTENSION_LOADER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_EXTENSION_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_EXTENSION_LOADER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_EXTENSION_LOADER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/extensions/external_extension_loader.h" 9 #include "chrome/browser/extensions/external_extension_loader.h"
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 15
16 // A specialization of the ExternalExtensionLoader that uses a json file to 16 // A specialization of the ExternalExtensionLoader that uses a json file to
17 // look up which external extensions are registered. 17 // look up which external extensions are registered.
18 // Instances of this class are expected to be created and destroyed on the UI 18 // Instances of this class are expected to be created and destroyed on the UI
19 // thread and they are expecting public method calls from the UI thread. 19 // thread and they are expecting public method calls from the UI thread.
20 class ExternalPrefExtensionLoader : public ExternalExtensionLoader { 20 class ExternalPrefExtensionLoader : public ExternalExtensionLoader {
21 public: 21 public:
22 enum Options {
23 NONE = 0,
24
25 // Ensure that only root can force an external install by checking
26 // that all components of the path to external extensions files are
27 // owned by root and not writable by any non-root user.
28 ENSURE_PATH_CONTROLLED_BY_ADMIN = 1<<0
29 };
30
22 // |base_path_key| is the directory containing the external_extensions.json 31 // |base_path_key| is the directory containing the external_extensions.json
23 // file. Relative file paths to extension files are resolved relative 32 // file. Relative file paths to extension files are resolved relative
24 // to this path. 33 // to this path.
25 explicit ExternalPrefExtensionLoader(int base_path_key); 34 explicit ExternalPrefExtensionLoader(int base_path_key, Options options);
26 35
27 virtual const FilePath GetBaseCrxFilePath(); 36 virtual const FilePath GetBaseCrxFilePath();
28 37
29 protected: 38 protected:
30 virtual void StartLoading(); 39 virtual void StartLoading();
40 bool IsOptionSet(Options opt) {
41 return (options_ & opt);
42 }
31 43
32 private: 44 private:
33 friend class base::RefCountedThreadSafe<ExternalExtensionLoader>; 45 friend class base::RefCountedThreadSafe<ExternalExtensionLoader>;
34 46
35 virtual ~ExternalPrefExtensionLoader() {} 47 virtual ~ExternalPrefExtensionLoader() {}
36 48
37 void LoadOnFileThread(); 49 void LoadOnFileThread();
38 50
39 int base_path_key_; 51 int base_path_key_;
52 Options options_;
40 FilePath base_path_; 53 FilePath base_path_;
41 54
42 DISALLOW_COPY_AND_ASSIGN(ExternalPrefExtensionLoader); 55 DISALLOW_COPY_AND_ASSIGN(ExternalPrefExtensionLoader);
43 }; 56 };
44 57
45 // A simplified version of ExternalPrefExtensionLoader that loads the dictionary 58 // A simplified version of ExternalPrefExtensionLoader that loads the dictionary
46 // from json data specified in a string. 59 // from json data specified in a string.
47 class ExternalTestingExtensionLoader : public ExternalExtensionLoader { 60 class ExternalTestingExtensionLoader : public ExternalExtensionLoader {
48 public: 61 public:
49 ExternalTestingExtensionLoader( 62 ExternalTestingExtensionLoader(
(...skipping 10 matching lines...) Expand all
60 73
61 virtual ~ExternalTestingExtensionLoader(); 74 virtual ~ExternalTestingExtensionLoader();
62 75
63 FilePath fake_base_path_; 76 FilePath fake_base_path_;
64 scoped_ptr<DictionaryValue> testing_prefs_; 77 scoped_ptr<DictionaryValue> testing_prefs_;
65 78
66 DISALLOW_COPY_AND_ASSIGN(ExternalTestingExtensionLoader); 79 DISALLOW_COPY_AND_ASSIGN(ExternalTestingExtensionLoader);
67 }; 80 };
68 81
69 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_EXTENSION_LOADER_H_ 82 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_EXTENSION_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698