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

Unified Diff: chrome/browser/ui/webui/options/chromeos/user_image_source.cc

Issue 9814030: get rid of old options pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes 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: chrome/browser/ui/webui/options/chromeos/user_image_source.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/user_image_source.cc b/chrome/browser/ui/webui/options/chromeos/user_image_source.cc
deleted file mode 100644
index c5297df60c526e61081823dfb3e3a422c5acf387..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/webui/options/chromeos/user_image_source.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.
-
-#include "chrome/browser/ui/webui/options/chromeos/user_image_source.h"
-
-#include "base/memory/ref_counted_memory.h"
-#include "base/message_loop.h"
-#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/common/url_constants.h"
-#include "grit/theme_resources.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/codec/png_codec.h"
-
-namespace chromeos {
-
-std::vector<unsigned char> UserImageSource::GetUserImage(
- const std::string& email) const {
- std::vector<unsigned char> user_image;
- const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email);
- if (user) {
- gfx::PNGCodec::EncodeBGRASkBitmap(user->image(), false, &user_image);
- return user_image;
- }
- gfx::PNGCodec::EncodeBGRASkBitmap(
- *ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_LOGIN_DEFAULT_USER),
- false,
- &user_image);
- return user_image;
-}
-
-UserImageSource::UserImageSource()
- : DataSource(chrome::kChromeUIUserImageHost, MessageLoop::current()) {
-}
-
-UserImageSource::~UserImageSource() {}
-
-void UserImageSource::StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id) {
- // Strip the query param value - we only use it as a hack to ensure our
- // image gets reloaded instead of being pulled from the browser cache
- std::string email = path.substr(0, path.find_first_of("?"));
- SendResponse(request_id, new RefCountedBytes(GetUserImage(email)));
-}
-
-std::string UserImageSource::GetMimeType(const std::string&) const {
- // We need to explicitly return a mime type, otherwise if the user tries to
- // drag the image they get no extension.
- return "image/png";
-}
-
-} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698