| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/app_window_contents.h" | 9 #include "chrome/browser/extensions/app_window_contents.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 shell_window_contents_->NativeWindowClosed(); | 302 shell_window_contents_->NativeWindowClosed(); |
| 303 delete this; | 303 delete this; |
| 304 } | 304 } |
| 305 | 305 |
| 306 void ShellWindow::OnNativeWindowChanged() { | 306 void ShellWindow::OnNativeWindowChanged() { |
| 307 SaveWindowPosition(); | 307 SaveWindowPosition(); |
| 308 if (shell_window_contents_ && native_app_window_) | 308 if (shell_window_contents_ && native_app_window_) |
| 309 shell_window_contents_->NativeWindowChanged(native_app_window_.get()); | 309 shell_window_contents_->NativeWindowChanged(native_app_window_.get()); |
| 310 } | 310 } |
| 311 | 311 |
| 312 gfx::Image* ShellWindow::GetAppListIcon() { | 312 scoped_ptr<gfx::Image> ShellWindow::GetAppListIcon() { |
| 313 // TODO(skuhne): We might want to use LoadImages in UpdateExtensionAppIcon | 313 // TODO(skuhne): We might want to use LoadImages in UpdateExtensionAppIcon |
| 314 // instead to let the extension give us pre-defined icons in the launcher | 314 // instead to let the extension give us pre-defined icons in the launcher |
| 315 // and the launcher list sizes. Since there is no mock yet, doing this now | 315 // and the launcher list sizes. Since there is no mock yet, doing this now |
| 316 // seems a bit premature and we scale for the time being. | 316 // seems a bit premature and we scale for the time being. |
| 317 if (app_icon_.IsEmpty()) | 317 if (app_icon_.IsEmpty()) |
| 318 return new gfx::Image(); | 318 return make_scoped_ptr(new gfx::Image()); |
| 319 | 319 |
| 320 SkBitmap bmp = skia::ImageOperations::Resize( | 320 SkBitmap bmp = skia::ImageOperations::Resize( |
| 321 *app_icon_.ToSkBitmap(), skia::ImageOperations::RESIZE_BEST, | 321 *app_icon_.ToSkBitmap(), skia::ImageOperations::RESIZE_BEST, |
| 322 extension_misc::EXTENSION_ICON_SMALLISH, | 322 extension_misc::EXTENSION_ICON_SMALLISH, |
| 323 extension_misc::EXTENSION_ICON_SMALLISH); | 323 extension_misc::EXTENSION_ICON_SMALLISH); |
| 324 return new gfx::Image(gfx::ImageSkia::CreateFrom1xBitmap(bmp)); | 324 return make_scoped_ptr( |
| 325 new gfx::Image(gfx::ImageSkia::CreateFrom1xBitmap(bmp))); |
| 325 } | 326 } |
| 326 | 327 |
| 327 content::WebContents* ShellWindow::web_contents() const { | 328 content::WebContents* ShellWindow::web_contents() const { |
| 328 return shell_window_contents_->GetWebContents(); | 329 return shell_window_contents_->GetWebContents(); |
| 329 } | 330 } |
| 330 | 331 |
| 331 NativeAppWindow* ShellWindow::GetBaseWindow() { | 332 NativeAppWindow* ShellWindow::GetBaseWindow() { |
| 332 return native_app_window_.get(); | 333 return native_app_window_.get(); |
| 333 } | 334 } |
| 334 | 335 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 const extensions::DraggableRegion& region = *iter; | 532 const extensions::DraggableRegion& region = *iter; |
| 532 sk_region->op( | 533 sk_region->op( |
| 533 region.bounds.x(), | 534 region.bounds.x(), |
| 534 region.bounds.y(), | 535 region.bounds.y(), |
| 535 region.bounds.right(), | 536 region.bounds.right(), |
| 536 region.bounds.bottom(), | 537 region.bounds.bottom(), |
| 537 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 538 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 538 } | 539 } |
| 539 return sk_region; | 540 return sk_region; |
| 540 } | 541 } |
| OLD | NEW |