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

Unified Diff: chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.h

Issue 10021066: Replace the index mapping of wallpaper picker UI and hard coded wallpaper index in C++ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 8 years, 8 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: chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.h
diff --git a/chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.h b/chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.h
new file mode 100644
index 0000000000000000000000000000000000000000..ed537a7850b570f93485095a473cbc6fa4d0f77c
--- /dev/null
+++ b/chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_THUMBNAIL_SOURCE2_H_
+#define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_THUMBNAIL_SOURCE2_H_
+#pragma once
+
+#include <string>
+
+#include "base/compiler_specific.h"
+#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
+
+namespace chromeos {
+namespace options2 {
+
+// Returns a string consisting of the prefix specified and the index of the
+// image. For example: chrome://wallpaper/default_2.
+std::string GetDefaultWallpaperThumbnailURL(int index);
+
+// Checks if the given URL points to one of the default wallpapers. If it is,
+// returns true and sets |wallpaper_index| to the corresponding index parsed
+// from URL. For example: chrome://wallpaper/default_2 will set
+// |wallpaper_index| to 2. If not a default wallpaper url, returns false.
+bool IsDefaultWallpaperURL(const std::string url, int* wallpaper_index);
James Hawkins 2012/04/20 19:40:17 I'm assuming |wallpaper_index| must not be NULL.
James Hawkins 2012/04/20 19:40:17 |url| must not be empty?
bshe 2012/04/20 21:11:43 Done.
bshe 2012/04/20 21:11:43 |url| seems can be empty but can't be null.
+
+// A DataSource for chrome://wallpaper/ URLs.
+class WallpaperThumbnailSource : public ChromeURLDataManager::DataSource {
+ public:
+ WallpaperThumbnailSource();
+
+ // Overridden from ChromeURLDataManager::DataSource:
James Hawkins 2012/04/20 19:40:17 nit: ChromeURLDataManager::DataSource implementati
bshe 2012/04/20 21:11:43 Done.
+ virtual void StartDataRequest(const std::string& path,
+ bool is_incognito,
+ int request_id) OVERRIDE;
+ virtual std::string GetMimeType(const std::string&) const OVERRIDE;
+
+ private:
+ virtual ~WallpaperThumbnailSource();
+
+ DISALLOW_COPY_AND_ASSIGN(WallpaperThumbnailSource);
+};
+
+} // namespace options2
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_WALLPAPER_THUMBNAIL_SOURCE2_H_

Powered by Google App Engine
This is Rietveld 408576698