OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 #include <utility> | 12 #include <utility> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "components/sessions/core/session_id.h" | 17 #include "components/sessions/core/session_id.h" |
18 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 18 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
19 #include "content/public/browser/web_contents_delegate.h" | 19 #include "content/public/browser/web_contents_delegate.h" |
20 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
21 #include "extensions/browser/extension_function_dispatcher.h" | 21 #include "extensions/browser/extension_function_dispatcher.h" |
22 #include "extensions/browser/extension_icon_image.h" | 22 #include "extensions/browser/extension_icon_image.h" |
23 #include "extensions/browser/extension_registry_observer.h" | 23 #include "extensions/browser/extension_registry_observer.h" |
24 #include "ui/base/ui_base_types.h" // WindowShowState | 24 #include "ui/base/ui_base_types.h" // WindowShowState |
25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // or minimized/maximized state has changed. | 265 // or minimized/maximized state has changed. |
266 void OnNativeWindowChanged(); | 266 void OnNativeWindowChanged(); |
267 | 267 |
268 // Should be called by native implementations when the window is activated. | 268 // Should be called by native implementations when the window is activated. |
269 void OnNativeWindowActivated(); | 269 void OnNativeWindowActivated(); |
270 | 270 |
271 // Specifies a url for the launcher icon. | 271 // Specifies a url for the launcher icon. |
272 void SetAppIconUrl(const GURL& icon_url); | 272 void SetAppIconUrl(const GURL& icon_url); |
273 | 273 |
274 // Set the window shape. Passing a NULL |region| sets the default shape. | 274 // Set the window shape. Passing a NULL |region| sets the default shape. |
275 void UpdateShape(scoped_ptr<SkRegion> region); | 275 void UpdateShape(std::unique_ptr<SkRegion> region); |
276 | 276 |
277 // Called from the render interface to modify the draggable regions. | 277 // Called from the render interface to modify the draggable regions. |
278 void UpdateDraggableRegions(const std::vector<DraggableRegion>& regions); | 278 void UpdateDraggableRegions(const std::vector<DraggableRegion>& regions); |
279 | 279 |
280 // Updates the app image to |image|. Called internally from the image loader | 280 // Updates the app image to |image|. Called internally from the image loader |
281 // callback. Also called externally for v1 apps using Ash Panels. | 281 // callback. Also called externally for v1 apps using Ash Panels. |
282 void UpdateAppIcon(const gfx::Image& image); | 282 void UpdateAppIcon(const gfx::Image& image); |
283 | 283 |
284 // Enable or disable fullscreen mode. |type| specifies which type of | 284 // Enable or disable fullscreen mode. |type| specifies which type of |
285 // fullscreen mode to change (note that disabling one type of fullscreen may | 285 // fullscreen mode to change (note that disabling one type of fullscreen may |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 361 |
362 // Whether the app window wants to be alpha enabled. | 362 // Whether the app window wants to be alpha enabled. |
363 bool requested_alpha_enabled() const { return requested_alpha_enabled_; } | 363 bool requested_alpha_enabled() const { return requested_alpha_enabled_; } |
364 | 364 |
365 // Whether the app window is created by IME extensions. | 365 // Whether the app window is created by IME extensions. |
366 // TODO(bshe): rename to hide_app_window_in_launcher if it is not used | 366 // TODO(bshe): rename to hide_app_window_in_launcher if it is not used |
367 // anywhere other than app_window_launcher_controller after M45. Otherwise, | 367 // anywhere other than app_window_launcher_controller after M45. Otherwise, |
368 // remove this TODO. | 368 // remove this TODO. |
369 bool is_ime_window() const { return is_ime_window_; } | 369 bool is_ime_window() const { return is_ime_window_; } |
370 | 370 |
371 void SetAppWindowContentsForTesting(scoped_ptr<AppWindowContents> contents) { | 371 void SetAppWindowContentsForTesting( |
| 372 std::unique_ptr<AppWindowContents> contents) { |
372 app_window_contents_ = std::move(contents); | 373 app_window_contents_ = std::move(contents); |
373 } | 374 } |
374 | 375 |
375 protected: | 376 protected: |
376 ~AppWindow() override; | 377 ~AppWindow() override; |
377 | 378 |
378 private: | 379 private: |
379 // PlatformAppBrowserTest needs access to web_contents() | 380 // PlatformAppBrowserTest needs access to web_contents() |
380 friend class PlatformAppBrowserTest; | 381 friend class PlatformAppBrowserTest; |
381 | 382 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 WindowType window_type_; | 510 WindowType window_type_; |
510 | 511 |
511 // Icon shown in the task bar. | 512 // Icon shown in the task bar. |
512 gfx::Image app_icon_; | 513 gfx::Image app_icon_; |
513 | 514 |
514 // Icon URL to be used for setting the app icon. If not empty, app_icon_ will | 515 // Icon URL to be used for setting the app icon. If not empty, app_icon_ will |
515 // be fetched and set using this URL. | 516 // be fetched and set using this URL. |
516 GURL app_icon_url_; | 517 GURL app_icon_url_; |
517 | 518 |
518 // An object to load the app's icon as an extension resource. | 519 // An object to load the app's icon as an extension resource. |
519 scoped_ptr<IconImage> app_icon_image_; | 520 std::unique_ptr<IconImage> app_icon_image_; |
520 | 521 |
521 scoped_ptr<NativeAppWindow> native_app_window_; | 522 std::unique_ptr<NativeAppWindow> native_app_window_; |
522 scoped_ptr<AppWindowContents> app_window_contents_; | 523 std::unique_ptr<AppWindowContents> app_window_contents_; |
523 scoped_ptr<AppDelegate> app_delegate_; | 524 std::unique_ptr<AppDelegate> app_delegate_; |
524 scoped_ptr<AppWebContentsHelper> helper_; | 525 std::unique_ptr<AppWebContentsHelper> helper_; |
525 | 526 |
526 // The initial url this AppWindow was navigated to. | 527 // The initial url this AppWindow was navigated to. |
527 GURL initial_url_; | 528 GURL initial_url_; |
528 | 529 |
529 // Bit field of FullscreenType. | 530 // Bit field of FullscreenType. |
530 int fullscreen_types_; | 531 int fullscreen_types_; |
531 | 532 |
532 // Show has been called, so the window should be shown once the first visually | 533 // Show has been called, so the window should be shown once the first visually |
533 // non-empty paint occurs. | 534 // non-empty paint occurs. |
534 bool show_on_first_paint_; | 535 bool show_on_first_paint_; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 base::Closure on_first_commit_callback_; | 571 base::Closure on_first_commit_callback_; |
571 | 572 |
572 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; | 573 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; |
573 | 574 |
574 DISALLOW_COPY_AND_ASSIGN(AppWindow); | 575 DISALLOW_COPY_AND_ASSIGN(AppWindow); |
575 }; | 576 }; |
576 | 577 |
577 } // namespace extensions | 578 } // namespace extensions |
578 | 579 |
579 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 580 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
OLD | NEW |