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

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

Issue 8417012: Refactor loading out of ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
Aaron Boodman 2011/10/28 22:21:58 Is this include needed?
Yoyo Zhou 2011/10/31 21:58:15 No.
13 #include "base/memory/weak_ptr.h"
14
15 class Extension;
16 class ExtensionService;
17 class FilePath;
18
19 // Installs and loads an unpacked extension.
20 // TODO(erikkay): It might be useful to be able to load a packed extension
21 // (presumably into memory) without installing it.
22 class UnpackedInstaller
Aaron Boodman 2011/10/28 22:21:58 I think it would make this a little cleaner if the
Aaron Boodman 2011/10/28 22:21:58 Throughout this change: consider putting all these
Yoyo Zhou 2011/10/31 21:58:15 It's meant to be used as one per installation, lik
Yoyo Zhou 2011/10/31 21:58:15 Done.
Aaron Boodman 2011/10/31 22:33:25 Ok, I was reacting to the file paths getting passe
Yoyo Zhou 2011/11/01 21:50:57 Oh, I suppose I could stop passing them around. It
23 : public base::RefCountedThreadSafe<UnpackedInstaller> {
24 public:
25 explicit UnpackedInstaller(base::WeakPtr<ExtensionService> extension_service);
26
27 // Loads the extension from the directory |extension_path|.
28 void Load(const FilePath& extension_path);
29
30 // Loads the extension from the directory |extension_path|;
31 // for use with command line switch --load-extension=path.
32 void LoadFromCommandLine(const FilePath& extension_path);
33
34 // Allows prompting for plugins to be disabled; intended for testing only.
35 bool prompt_for_plugins() { return prompt_for_plugins_; }
Aaron Boodman 2011/10/28 22:21:58 I think that this may no longer be needed. For awh
Yoyo Zhou 2011/10/31 21:58:15 This is used in tests. I'm not sure about removing
36 void set_prompt_for_plugins(bool val) { prompt_for_plugins_ = val; }
37
38 private:
39 friend class base::RefCountedThreadSafe<UnpackedInstaller>;
40
41 virtual ~UnpackedInstaller();
42
43 // Loads a single extension from |path| where |path| is the top directory of
44 // a specific extension where its manifest file lives.
45 // Errors are reported through ExtensionErrorReporter. On success,
46 // ExtensionService::AddExtension() is called.
47 void LoadSingleExtension(const FilePath &extension_path);
48
49 // LoadSingleExtension needs to check the file access preference, which needs
50 // to happen back on the UI thread, so it posts CheckExtensionFileAccess on
51 // the UI thread. In turn, once that gets the pref, it goes back to the
52 // file thread with LoadSingleExtensionWithFileAccess.
53 void CheckExtensionFileAccess(const FilePath& extension_path);
54 void LoadSingleExtensionWithFileAccess(
55 const FilePath &path, bool allow_file_access);
56
57 // Notify the frontend that there was an error loading an extension.
58 void ReportExtensionLoadError(const FilePath& extension_path,
59 const std::string& error);
60
61 // Called when an unpacked extension has been loaded and installed.
62 void OnLoadSingleExtension(const scoped_refptr<const Extension>& extension);
63
64 base::WeakPtr<ExtensionService> service_weak_;
65
66 // If true and the extension contains plugins, we prompt the user before
67 // loading.
68 bool prompt_for_plugins_;
69
70 DISALLOW_COPY_AND_ASSIGN(UnpackedInstaller);
71 };
72
73 #endif // CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698