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

Side by Side Diff: ui/base/resource/data_pack.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « ui/base/dragdrop/download_file_interface.h ('k') | ui/base/text/text_elider.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // DataPack represents a read-only view onto an on-disk file that contains 5 // DataPack represents a read-only view onto an on-disk file that contains
6 // (key, value) pairs of data. It's used to store static resources like 6 // (key, value) pairs of data. It's used to store static resources like
7 // translation strings and images. 7 // translation strings and images.
8 8
9 #ifndef UI_BASE_RESOURCE_DATA_PACK_H_ 9 #ifndef UI_BASE_RESOURCE_DATA_PACK_H_
10 #define UI_BASE_RESOURCE_DATA_PACK_H_ 10 #define UI_BASE_RESOURCE_DATA_PACK_H_
11 11
12 #include <map> 12 #include <map>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/platform_file.h" 16 #include "base/platform_file.h"
17 #include "base/string_piece.h" 17 #include "base/string_piece.h"
18 #include "ui/base/layout.h" 18 #include "ui/base/layout.h"
19 #include "ui/base/resource/resource_handle.h" 19 #include "ui/base/resource/resource_handle.h"
20 #include "ui/base/ui_export.h" 20 #include "ui/base/ui_export.h"
21 21
22 namespace base {
22 class FilePath; 23 class FilePath;
23
24 namespace base {
25 class RefCountedStaticMemory; 24 class RefCountedStaticMemory;
26 } 25 }
27 26
28 namespace file_util { 27 namespace file_util {
29 class MemoryMappedFile; 28 class MemoryMappedFile;
30 } 29 }
31 30
32 namespace ui { 31 namespace ui {
33 32
34 class UI_EXPORT DataPack : public ResourceHandle { 33 class UI_EXPORT DataPack : public ResourceHandle {
35 public: 34 public:
36 DataPack(ui::ScaleFactor scale_factor); 35 DataPack(ui::ScaleFactor scale_factor);
37 virtual ~DataPack(); 36 virtual ~DataPack();
38 37
39 // Load a pack file from |path|, returning false on error. 38 // Load a pack file from |path|, returning false on error.
40 bool LoadFromPath(const FilePath& path); 39 bool LoadFromPath(const base::FilePath& path);
41 40
42 // Loads a pack file from |file|, returning false on error. 41 // Loads a pack file from |file|, returning false on error.
43 bool LoadFromFile(base::PlatformFile file); 42 bool LoadFromFile(base::PlatformFile file);
44 43
45 // Writes a pack file containing |resources| to |path|. If there are any 44 // Writes a pack file containing |resources| to |path|. If there are any
46 // text resources to be written, their encoding must already agree to the 45 // text resources to be written, their encoding must already agree to the
47 // |textEncodingType| specified. If no text resources are present, please 46 // |textEncodingType| specified. If no text resources are present, please
48 // indicate BINARY. 47 // indicate BINARY.
49 static bool WritePack(const FilePath& path, 48 static bool WritePack(const base::FilePath& path,
50 const std::map<uint16, base::StringPiece>& resources, 49 const std::map<uint16, base::StringPiece>& resources,
51 TextEncodingType textEncodingType); 50 TextEncodingType textEncodingType);
52 51
53 // ResourceHandle implementation: 52 // ResourceHandle implementation:
54 virtual bool HasResource(uint16 resource_id) const OVERRIDE; 53 virtual bool HasResource(uint16 resource_id) const OVERRIDE;
55 virtual bool GetStringPiece(uint16 resource_id, 54 virtual bool GetStringPiece(uint16 resource_id,
56 base::StringPiece* data) const OVERRIDE; 55 base::StringPiece* data) const OVERRIDE;
57 virtual base::RefCountedStaticMemory* GetStaticMemory( 56 virtual base::RefCountedStaticMemory* GetStaticMemory(
58 uint16 resource_id) const OVERRIDE; 57 uint16 resource_id) const OVERRIDE;
59 virtual TextEncodingType GetTextEncodingType() const OVERRIDE; 58 virtual TextEncodingType GetTextEncodingType() const OVERRIDE;
(...skipping 15 matching lines...) Expand all
75 // The scale of the image in this resource pack relative to images in the 1x 74 // The scale of the image in this resource pack relative to images in the 1x
76 // resource pak. 75 // resource pak.
77 ui::ScaleFactor scale_factor_; 76 ui::ScaleFactor scale_factor_;
78 77
79 DISALLOW_COPY_AND_ASSIGN(DataPack); 78 DISALLOW_COPY_AND_ASSIGN(DataPack);
80 }; 79 };
81 80
82 } // namespace ui 81 } // namespace ui
83 82
84 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ 83 #endif // UI_BASE_RESOURCE_DATA_PACK_H_
OLDNEW
« no previous file with comments | « ui/base/dragdrop/download_file_interface.h ('k') | ui/base/text/text_elider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698