Store window icon as ImageSkia.

This commit is contained in:
Cheng Zhao 2014-08-11 10:06:46 +08:00
parent a696f06a23
commit 445fe158cc
3 changed files with 4 additions and 13 deletions

View file

@ -45,8 +45,6 @@
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/point.h" #include "ui/gfx/point.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
#include "ui/gfx/size.h" #include "ui/gfx/size.h"
@ -70,9 +68,7 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
options.Get(switches::kFrame, &has_frame_); options.Get(switches::kFrame, &has_frame_);
// Read icon before window is created. // Read icon before window is created.
gfx::ImageSkia icon; options.Get(switches::kIcon, &icon_);
if (options.Get(switches::kIcon, &icon))
icon_.reset(new gfx::Image(icon));
// Read iframe security before any navigation. // Read iframe security before any navigation.
options.Get(switches::kNodeIntegration, &node_integration_); options.Get(switches::kNodeIntegration, &node_integration_);

View file

@ -21,6 +21,7 @@
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
#include "native_mate/scoped_persistent.h" #include "native_mate/scoped_persistent.h"
#include "ui/gfx/image/image_skia.h"
struct WebPreferences; struct WebPreferences;
@ -34,7 +35,6 @@ class WebContents;
} }
namespace gfx { namespace gfx {
class Image;
class Point; class Point;
class Rect; class Rect;
class Size; class Size;
@ -252,7 +252,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
bool has_frame_; bool has_frame_;
// Window icon. // Window icon.
scoped_ptr<gfx::Image> icon_; gfx::ImageSkia icon_;
private: private:
// Schedule a notification unresponsive event. // Schedule a notification unresponsive event.

View file

@ -28,8 +28,6 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"
#include "ui/base/hit_test.h" #include "ui/base/hit_test.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
#include "ui/views/controls/webview/webview.h" #include "ui/views/controls/webview/webview.h"
@ -492,10 +490,7 @@ bool NativeWindowViews::ShouldHandleSystemCommands() const {
} }
gfx::ImageSkia NativeWindowViews::GetWindowAppIcon() { gfx::ImageSkia NativeWindowViews::GetWindowAppIcon() {
if (icon_) return icon_;
return *(icon_->ToImageSkia());
else
return gfx::ImageSkia();
} }
gfx::ImageSkia NativeWindowViews::GetWindowIcon() { gfx::ImageSkia NativeWindowViews::GetWindowIcon() {