diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-08 19:01:02 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-08 19:01:02 +0000 |
commit | 0f38ceaebbc66b29fb3297516f74f9c8379d902f (patch) | |
tree | 8af215d4a01c60a2d3a5fe0aa55fd35cab05a744 /chrome/browser/icon_loader_win.cc | |
parent | eac83f0d14be2fed85edf2ffad934dd1309819e7 (diff) | |
download | chromium_src-0f38ceaebbc66b29fb3297516f74f9c8379d902f.zip chromium_src-0f38ceaebbc66b29fb3297516f74f9c8379d902f.tar.gz chromium_src-0f38ceaebbc66b29fb3297516f74f9c8379d902f.tar.bz2 |
Stub implementation of linux, mac icon loader/manager.
Define a platform specific type IconGroupID which helps with caching multiple requests for the same icon. Previously we just used the file path (or the extension), but on POSIX we use mime types rather than extensions.
Review URL: http://codereview.chromium.org/113120
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/icon_loader_win.cc')
-rw-r--r-- | chrome/browser/icon_loader_win.cc | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/chrome/browser/icon_loader_win.cc b/chrome/browser/icon_loader_win.cc index 998faf1..1d47c37 100644 --- a/chrome/browser/icon_loader_win.cc +++ b/chrome/browser/icon_loader_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/icon_loader_win.h" +#include "chrome/browser/icon_loader.h" #include <windows.h> #include <shellapi.h> @@ -11,34 +11,8 @@ #include "base/gfx/size.h" #include "base/message_loop.h" #include "base/thread.h" -#include "chrome/browser/browser_process.h" -#include "skia/include/SkBitmap.h" -IconLoader* IconLoader::Create(const FilePath& path, IconSize size, - Delegate* delegate) { - return new IconLoaderWin(path, size, delegate); -} - -IconLoaderWin::IconLoaderWin(const FilePath& path, IconSize size, - Delegate* delegate) - : path_(path), - icon_size_(size), - bitmap_(NULL), - delegate_(delegate) { -} - -IconLoaderWin::~IconLoaderWin() { - delete bitmap_; -} - -void IconLoaderWin::Start() { - target_message_loop_ = MessageLoop::current(); - - g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(this, &IconLoaderWin::ReadIcon)); -} - -void IconLoaderWin::ReadIcon() { +void IconLoader::ReadIcon() { int size = 0; switch (icon_size_) { case IconLoader::SMALL: @@ -54,7 +28,7 @@ void IconLoaderWin::ReadIcon() { NOTREACHED(); } SHFILEINFO file_info = { 0 }; - if (!SHGetFileInfo(path_.value().c_str(), FILE_ATTRIBUTE_NORMAL, &file_info, + if (!SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info, sizeof(SHFILEINFO), SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) return; @@ -71,10 +45,5 @@ void IconLoaderWin::ReadIcon() { bitmap_ = IconUtil::CreateSkBitmapFromHICON(file_info.hIcon, icon_size); target_message_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &IconLoaderWin::NotifyDelegate)); -} - -void IconLoaderWin::NotifyDelegate() { - delegate_->OnBitmapLoaded(this, bitmap_); - bitmap_ = NULL; + NewRunnableMethod(this, &IconLoader::NotifyDelegate)); } |