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

Unified Diff: ash/desktop_background/desktop_background_resources.cc

Issue 9580023: Enable user change background image in settings page in Aura build. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Address reveiw and auto select the current wallpaper thumbnail when select wallpaper overlay shows. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ash/desktop_background/desktop_background_resources.cc
diff --git a/ash/desktop_background/desktop_background_resources.cc b/ash/desktop_background/desktop_background_resources.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0ed245c8945570ef7b917e9da458b1104033f0be
--- /dev/null
+++ b/ash/desktop_background/desktop_background_resources.cc
@@ -0,0 +1,65 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/desktop_background/desktop_background_resources.h"
+
+#include "base/logging.h"
+#include "grit/ui_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/image/image.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace ash {
+
+namespace internal {
flackr 2012/03/08 01:19:59 You can remove name from namespace: namespace { A
bshe 2012/03/08 03:19:24 Done.
+ const int kDefaultWallpaperResources[] = {
+ IDR_AURA_WALLPAPER_1,
+ IDR_AURA_WALLPAPER_2,
+ IDR_AURA_WALLPAPER_3,
+ IDR_AURA_WALLPAPER_4,
+ IDR_AURA_WALLPAPER_5,
+ IDR_AURA_WALLPAPER_6,
+ IDR_AURA_WALLPAPER_7,
+ IDR_AURA_WALLPAPER_8,
+ IDR_AURA_WALLPAPER_9,
+ };
+
+ const int kDefaultWallpaperResourcesThumb[] = {
+ IDR_AURA_WALLPAPER_1_THUMB,
+ IDR_AURA_WALLPAPER_2_THUMB,
+ IDR_AURA_WALLPAPER_3_THUMB,
+ IDR_AURA_WALLPAPER_4_THUMB,
+ IDR_AURA_WALLPAPER_5_THUMB,
+ IDR_AURA_WALLPAPER_6_THUMB,
+ IDR_AURA_WALLPAPER_7_THUMB,
+ IDR_AURA_WALLPAPER_8_THUMB,
+ IDR_AURA_WALLPAPER_9_THUMB,
+ };
+
+ const int kDefaultWallpaperCount = arraysize(kDefaultWallpaperResources);
+
+ const int kPresetWallpaperIndex = 0;
+}
flackr 2012/03/08 01:19:59 } // namespace
bshe 2012/03/08 03:19:24 Done.
+
+int GetPresetWallpaperIndex() {
+ return internal::kPresetWallpaperIndex;
+}
+
+int GetWallpaperCount() {
+ return internal::kDefaultWallpaperCount;
+}
+
+const SkBitmap& GetDefaultWallpaper(int index) {
+ DCHECK(index >= 0 && index < internal::kDefaultWallpaperCount);
+ return *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
+ internal::kDefaultWallpaperResources[index]).ToSkBitmap();
+}
+
+const SkBitmap& GetDefaultWallpaperThumbnail(int index) {
+ DCHECK(index >= 0 && index < internal::kDefaultWallpaperCount);
+ return *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
+ internal::kDefaultWallpaperResourcesThumb[index]).ToSkBitmap();
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698