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

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

Issue 1955773002: Enable MD by default on Windows for Canary/Dev and local builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DISALLOW_IMPLICIT_CONSTRUCTORS Created 4 years, 7 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
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 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 5 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 base::StringPiece* value) = 0; 109 base::StringPiece* value) = 0;
110 110
111 // Retrieve a localized string. Return true if a string was provided or 111 // Retrieve a localized string. Return true if a string was provided or
112 // false to attempt retrieval of the default string. 112 // false to attempt retrieval of the default string.
113 virtual bool GetLocalizedString(int message_id, base::string16* value) = 0; 113 virtual bool GetLocalizedString(int message_id, base::string16* value) = 0;
114 114
115 protected: 115 protected:
116 virtual ~Delegate() {} 116 virtual ~Delegate() {}
117 }; 117 };
118 118
119 // A class which is designed to be instantiated on the stack during early
120 // startup code that needs access to string resources before the
121 // ResourceBundle may be loaded.
122 //
123 // This incurs a performance hit, so this should only be used in exceptional
124 // circumstances. Most uses of resources should wait until after the
125 // ResourceBundle has been loaded properly.
126 class UI_BASE_EXPORT TemporaryLoader {
127 public:
128 TemporaryLoader();
129 ~TemporaryLoader();
130
131 private:
132 // Mac loads resources earlier than other platforms and thus may have
133 // already initialized the resource bundle when we're constructed. Instead
134 // of trying to ifdef Mac or otherwise define exactly when we should and
135 // shouldn't load, we just set this based on whether the shared instance
136 // exists and then do nothing if it's set.
137 bool already_loaded_;
138
139 DISALLOW_COPY_AND_ASSIGN(TemporaryLoader);
140 };
141
119 // Initialize the ResourceBundle for this process. Does not take ownership of 142 // Initialize the ResourceBundle for this process. Does not take ownership of
120 // the |delegate| value. Returns the language selected. 143 // the |delegate| value. Returns the language selected.
121 // NOTE: Mac ignores this and always loads up resources for the language 144 // NOTE: Mac ignores this and always loads up resources for the language
122 // defined by the Cocoa UI (i.e., NSBundle does the language work). 145 // defined by the Cocoa UI (i.e., NSBundle does the language work).
123 // 146 //
124 // TODO(sergeyu): This method also loads common resources (i.e. chrome.pak). 147 // TODO(sergeyu): This method also loads common resources (i.e. chrome.pak).
125 // There is no way to specify which resource files are loaded, i.e. names of 148 // There is no way to specify which resource files are loaded, i.e. names of
126 // the files are hardcoded in ResourceBundle. Fix it to allow to specify which 149 // the files are hardcoded in ResourceBundle. Fix it to allow to specify which
127 // files are loaded (e.g. add a new method in Delegate). 150 // files are loaded (e.g. add a new method in Delegate).
128 // |load_resources| controls whether or not LoadCommonResources is called. 151 // |load_resources| controls whether or not LoadCommonResources is called.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 466
444 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); 467 DISALLOW_COPY_AND_ASSIGN(ResourceBundle);
445 }; 468 };
446 469
447 } // namespace ui 470 } // namespace ui
448 471
449 // TODO(beng): Someday, maybe, get rid of this. 472 // TODO(beng): Someday, maybe, get rid of this.
450 using ui::ResourceBundle; 473 using ui::ResourceBundle;
451 474
452 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 475 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
OLDNEW
« no previous file with comments | « ui/base/material_design/material_design_controller_unittest.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698