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