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

Side by Side Diff: chrome/browser/chromeos/login/helper.cc

Issue 6893052: Make customization documents singletons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments resolved Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/chromeos/login/helper.h" 5 #include "chrome/browser/chromeos/login/helper.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chrome/browser/chromeos/cros/network_library.h" 8 #include "chrome/browser/chromeos/cros/network_library.h"
9 #include "chrome/browser/chromeos/customization_document.h"
10 #include "chrome/browser/chromeos/system_access.h" 9 #include "chrome/browser/chromeos/system_access.h"
11 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
12 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
13 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
14 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
15 #include "third_party/skia/include/effects/SkGradientShader.h" 14 #include "third_party/skia/include/effects/SkGradientShader.h"
16 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/canvas_skia.h" 17 #include "ui/gfx/canvas_skia.h"
19 #include "views/controls/button/menu_button.h" 18 #include "views/controls/button/menu_button.h"
(...skipping 15 matching lines...) Expand all
35 34
36 // Time in ms before smoothed throbber is shown. 35 // Time in ms before smoothed throbber is shown.
37 const int kThrobberStartDelayMs = 500; 36 const int kThrobberStartDelayMs = 500;
38 37
39 const SkColor kBackgroundCenterColor = SkColorSetRGB(41, 50, 67); 38 const SkColor kBackgroundCenterColor = SkColorSetRGB(41, 50, 67);
40 const SkColor kBackgroundEdgeColor = SK_ColorBLACK; 39 const SkColor kBackgroundEdgeColor = SK_ColorBLACK;
41 40
42 const char kAccountRecoveryHelpUrl[] = 41 const char kAccountRecoveryHelpUrl[] =
43 "https://www.google.com/support/accounts/bin/answer.py?answer=48598"; 42 "https://www.google.com/support/accounts/bin/answer.py?answer=48598";
44 43
45 // Path to OEM partner startup customization manifest.
46 const char kStartupCustomizationManifestPath[] =
47 "/opt/oem/etc/startup_manifest.json";
48
49 class BackgroundPainter : public views::Painter { 44 class BackgroundPainter : public views::Painter {
50 public: 45 public:
51 BackgroundPainter() {} 46 BackgroundPainter() {}
52 47
53 virtual void Paint(int w, int h, gfx::Canvas* canvas) { 48 virtual void Paint(int w, int h, gfx::Canvas* canvas) {
54 SkRect rect; 49 SkRect rect;
55 rect.set(SkIntToScalar(0), 50 rect.set(SkIntToScalar(0),
56 SkIntToScalar(0), 51 SkIntToScalar(0),
57 SkIntToScalar(w), 52 SkIntToScalar(w),
58 SkIntToScalar(h)); 53 SkIntToScalar(h));
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); 213 return l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
219 } else if (network_library->wifi_connecting()) { 214 } else if (network_library->wifi_connecting()) {
220 return ASCIIToUTF16(network_library->wifi_network()->name()); 215 return ASCIIToUTF16(network_library->wifi_network()->name());
221 } else if (network_library->cellular_connecting()) { 216 } else if (network_library->cellular_connecting()) {
222 return ASCIIToUTF16(network_library->cellular_network()->name()); 217 return ASCIIToUTF16(network_library->cellular_network()->name());
223 } else { 218 } else {
224 return string16(); 219 return string16();
225 } 220 }
226 } 221 }
227 222
228 const chromeos::StartupCustomizationDocument* LoadStartupManifest() {
229 // Loading manifest causes us to do blocking IO on UI thread.
230 // Temporarily allow it until we fix http://crosbug.com/11103
231 base::ThreadRestrictions::ScopedAllowIO allow_io;
232 FilePath startup_manifest_path(kStartupCustomizationManifestPath);
233 if (file_util::PathExists(startup_manifest_path)) {
234 chromeos::SystemAccess* system = chromeos::SystemAccess::GetInstance();
235 scoped_ptr<chromeos::StartupCustomizationDocument> customization(
236 new chromeos::StartupCustomizationDocument(system));
237 bool manifest_loaded = customization->LoadManifestFromFile(
238 startup_manifest_path);
239 if (manifest_loaded) {
240 VLOG(1) << "Startup manifest loaded successfully";
241 return customization.release();
242 }
243 LOG(ERROR) << "Error loading startup manifest: "
244 << kStartupCustomizationManifestPath;
245 }
246
247 return NULL;
248 }
249
250 namespace login { 223 namespace login {
251 224
252 gfx::Size WideButton::GetPreferredSize() { 225 gfx::Size WideButton::GetPreferredSize() {
253 gfx::Size preferred_size = NativeButton::GetPreferredSize(); 226 gfx::Size preferred_size = NativeButton::GetPreferredSize();
254 // Set minimal width. 227 // Set minimal width.
255 if (preferred_size.width() < kButtonMinWidth) 228 if (preferred_size.width() < kButtonMinWidth)
256 preferred_size.set_width(kButtonMinWidth); 229 preferred_size.set_width(kButtonMinWidth);
257 return preferred_size; 230 return preferred_size;
258 } 231 }
259 232
260 } // namespace login 233 } // namespace login
261 234
262 } // namespace chromeos 235 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/helper.h ('k') | chrome/browser/chromeos/login/login_display_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698