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

Side by Side Diff: chrome/common/extensions/extension_resource.h

Issue 1075006: Eliminate all UI thread decoding of extension images.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/extension_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 9
10 // Represents a resource inside an extension. For example, an image, or a 10 // Represents a resource inside an extension. For example, an image, or a
11 // JavaScript file. This is more complicated than just a simple FilePath 11 // JavaScript file. This is more complicated than just a simple FilePath
12 // because extension resources can come from multiple physical file locations 12 // because extension resources can come from multiple physical file locations
13 // depending on locale. 13 // depending on locale.
14 class ExtensionResource { 14 class ExtensionResource {
15 public: 15 public:
16 ExtensionResource(); 16 ExtensionResource();
17 17
18 ExtensionResource(const FilePath& extension_root, 18 ExtensionResource(const FilePath& extension_root,
19 const FilePath& relative_path); 19 const FilePath& relative_path);
20 20
21 // Returns actual path to the resource (default or locale specific). 21 // Returns actual path to the resource (default or locale specific).
22 // *** MIGHT HIT FILESYSTEM. Do not call on UI thread! *** 22 // *** MIGHT HIT FILESYSTEM. Do not call on UI thread! ***
23 // NOTE: If you need to access ExtensionResources, such as bitmaps, on the UI
24 // thread, please use the ImageLoadingTracker, which uses the File thread.
23 const FilePath& GetFilePath() const; 25 const FilePath& GetFilePath() const;
24 26
25 // Static version to avoid creating an instance of ExtensionResource 27 // Static version to avoid creating an instance of ExtensionResource
26 // when all we want is the localization code. 28 // when all we want is the localization code.
27 // *** MIGHT HIT FILESYSTEM. Do not call on UI thread! *** 29 // *** MIGHT HIT FILESYSTEM. Do not call on UI thread! ***
30 // NOTE: If you need to access ExtensionResources, such as bitmaps, on the UI
31 // thread, please use the ImageLoadingTracker, which uses the File thread.
28 static FilePath GetFilePath(const FilePath& extension_root, 32 static FilePath GetFilePath(const FilePath& extension_root,
29 const FilePath& relative_path); 33 const FilePath& relative_path);
30 34
31 // Getters 35 // Getters
32 const FilePath& extension_root() const { return extension_root_; } 36 const FilePath& extension_root() const { return extension_root_; }
33 const FilePath& relative_path() const { return relative_path_; } 37 const FilePath& relative_path() const { return relative_path_; }
34 38
35 // Unittest helpers. 39 // Unit test helpers.
36 FilePath::StringType NormalizeSeperators(FilePath::StringType path) const; 40 FilePath::StringType NormalizeSeperators(FilePath::StringType path) const;
37 bool ComparePathWithDefault(const FilePath& path) const; 41 bool ComparePathWithDefault(const FilePath& path) const;
38 42
39 private: 43 private:
40 // Extension root. 44 // Extension root.
41 FilePath extension_root_; 45 FilePath extension_root_;
42 46
43 // Relative path to resource. 47 // Relative path to resource.
44 FilePath relative_path_; 48 FilePath relative_path_;
45 49
46 // Full path to extension resource. Starts empty. 50 // Full path to extension resource. Starts empty.
47 mutable FilePath full_resource_path_; 51 mutable FilePath full_resource_path_;
48 }; 52 };
49 53
50 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ 54 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/extension_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698