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

Side by Side Diff: chromecast/common/cast_resource_delegate.h

Issue 467043002: Adds locale strings to Chromecast build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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
« no previous file with comments | « chromecast/chromecast_locales.gyp ('k') | chromecast/common/cast_resource_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMECAST_COMMON_CAST_RESOURCE_DELEGATE_H_
6 #define CHROMECAST_COMMON_CAST_RESOURCE_DELEGATE_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted_memory.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "ui/base/resource/resource_bundle.h"
14
15 namespace base {
16 class FilePath;
17 }
18
19 namespace gfx {
20 class Image;
21 }
22
23 namespace chromecast {
24
25 // A singleton resource bundle delegate. Primary purpose is to indicate the
26 // correct locale pack file to load.
27 class CastResourceDelegate : public ui::ResourceBundle::Delegate {
28 public:
29 // Returns the singleton of delegate. It doesn't create an instance.
30 static CastResourceDelegate* GetInstance();
31
32 CastResourceDelegate();
33 virtual ~CastResourceDelegate();
34
35 // ui:ResourceBundle::Delegate implementation:
36 virtual base::FilePath GetPathForResourcePack(
37 const base::FilePath& pack_path,
38 ui::ScaleFactor scale_factor) OVERRIDE;
39 virtual base::FilePath GetPathForLocalePack(
40 const base::FilePath& pack_path,
41 const std::string& locale) OVERRIDE;
42 virtual gfx::Image GetImageNamed(int resource_id) OVERRIDE;
43 virtual gfx::Image GetNativeImageNamed(
44 int resource_id,
45 ui::ResourceBundle::ImageRTL rtl) OVERRIDE;
46 virtual base::RefCountedStaticMemory* LoadDataResourceBytes(
47 int resource_id,
48 ui::ScaleFactor scale_factor) OVERRIDE;
49 virtual bool GetRawDataResource(int resource_id,
50 ui::ScaleFactor scale_factor,
51 base::StringPiece* value) OVERRIDE;
52 virtual bool GetLocalizedString(int message_id,
53 base::string16* value) OVERRIDE;
54 virtual scoped_ptr<gfx::Font> GetFont(
55 ui::ResourceBundle::FontStyle style) OVERRIDE;
56
57 // Adds/removes/clears extra localized strings.
58 void AddExtraLocalizedString(int resource_id,
59 const base::string16& localized);
60 void RemoveExtraLocalizedString(int resource_id);
61 void ClearAllExtraLocalizedStrings();
62
63 private:
64 typedef base::hash_map<int, base::string16> ExtraLocaledStringMap;
65
66 ExtraLocaledStringMap extra_localized_strings_;
67
68 DISALLOW_COPY_AND_ASSIGN(CastResourceDelegate);
69 };
70
71 } // namespace chromecast
72
73 #endif // CHROMECAST_COMMON_CAST_RESOURCE_DELEGATE_H_
OLDNEW
« no previous file with comments | « chromecast/chromecast_locales.gyp ('k') | chromecast/common/cast_resource_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698