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 APPS_APP_WINDOW_H_ | 5 #ifndef APPS_APP_WINDOW_H_ |
6 #define APPS_APP_WINDOW_H_ | 6 #define APPS_APP_WINDOW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/sessions/session_id.h" | 13 #include "chrome/browser/sessions/session_id.h" |
14 #include "components/web_modal/popup_manager.h" | 14 #include "components/web_modal/popup_manager.h" |
15 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 15 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/browser/web_contents_delegate.h" | 18 #include "content/public/browser/web_contents_delegate.h" |
19 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
20 #include "content/public/common/console_message_level.h" | |
21 #include "extensions/browser/extension_icon_image.h" | 20 #include "extensions/browser/extension_icon_image.h" |
22 #include "ui/base/ui_base_types.h" // WindowShowState | 21 #include "ui/base/ui_base_types.h" // WindowShowState |
23 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
24 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
25 | 24 |
26 class GURL; | 25 class GURL; |
27 class SkRegion; | 26 class SkRegion; |
28 | 27 |
29 namespace base { | 28 namespace base { |
30 class DictionaryValue; | 29 class DictionaryValue; |
(...skipping 12 matching lines...) Expand all Loading... |
43 struct DraggableRegion; | 42 struct DraggableRegion; |
44 } | 43 } |
45 | 44 |
46 namespace ui { | 45 namespace ui { |
47 class BaseWindow; | 46 class BaseWindow; |
48 } | 47 } |
49 | 48 |
50 namespace apps { | 49 namespace apps { |
51 | 50 |
52 class AppDelegate; | 51 class AppDelegate; |
| 52 class AppWebContentsHelper; |
53 class NativeAppWindow; | 53 class NativeAppWindow; |
54 | 54 |
55 // Manages the web contents for app windows. The implementation for this | 55 // Manages the web contents for app windows. The implementation for this |
56 // class should create and maintain the WebContents for the window, and handle | 56 // class should create and maintain the WebContents for the window, and handle |
57 // any message passing between the web contents and the extension system or | 57 // any message passing between the web contents and the extension system or |
58 // native window. | 58 // native window. |
59 class AppWindowContents { | 59 class AppWindowContents { |
60 public: | 60 public: |
61 AppWindowContents() {} | 61 AppWindowContents() {} |
62 virtual ~AppWindowContents() {} | 62 virtual ~AppWindowContents() {} |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 virtual void Observe(int type, | 420 virtual void Observe(int type, |
421 const content::NotificationSource& source, | 421 const content::NotificationSource& source, |
422 const content::NotificationDetails& details) OVERRIDE; | 422 const content::NotificationDetails& details) OVERRIDE; |
423 | 423 |
424 // web_modal::WebContentsModalDialogManagerDelegate implementation. | 424 // web_modal::WebContentsModalDialogManagerDelegate implementation. |
425 virtual void SetWebContentsBlocked(content::WebContents* web_contents, | 425 virtual void SetWebContentsBlocked(content::WebContents* web_contents, |
426 bool blocked) OVERRIDE; | 426 bool blocked) OVERRIDE; |
427 virtual bool IsWebContentsVisible(content::WebContents* web_contents) | 427 virtual bool IsWebContentsVisible(content::WebContents* web_contents) |
428 OVERRIDE; | 428 OVERRIDE; |
429 | 429 |
430 // Helper method to add a message to the renderer's DevTools console. | |
431 void AddMessageToDevToolsConsole(content::ConsoleMessageLevel level, | |
432 const std::string& message); | |
433 | |
434 // Saves the window geometry/position/screen bounds. | 430 // Saves the window geometry/position/screen bounds. |
435 void SaveWindowPosition(); | 431 void SaveWindowPosition(); |
436 | 432 |
437 // Helper method to adjust the cached bounds so that we can make sure it can | 433 // Helper method to adjust the cached bounds so that we can make sure it can |
438 // be visible on the screen. See http://crbug.com/145752. | 434 // be visible on the screen. See http://crbug.com/145752. |
439 void AdjustBoundsToBeVisibleOnScreen(const gfx::Rect& cached_bounds, | 435 void AdjustBoundsToBeVisibleOnScreen(const gfx::Rect& cached_bounds, |
440 const gfx::Rect& cached_screen_bounds, | 436 const gfx::Rect& cached_screen_bounds, |
441 const gfx::Rect& current_screen_bounds, | 437 const gfx::Rect& current_screen_bounds, |
442 const gfx::Size& minimum_size, | 438 const gfx::Size& minimum_size, |
443 gfx::Rect* bounds) const; | 439 gfx::Rect* bounds) const; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // URL to be used for setting the badge on the app icon. | 508 // URL to be used for setting the badge on the app icon. |
513 GURL badge_icon_url_; | 509 GURL badge_icon_url_; |
514 | 510 |
515 // An object to load the badge as an extension resource. | 511 // An object to load the badge as an extension resource. |
516 scoped_ptr<extensions::IconImage> badge_icon_image_; | 512 scoped_ptr<extensions::IconImage> badge_icon_image_; |
517 | 513 |
518 scoped_ptr<NativeAppWindow> native_app_window_; | 514 scoped_ptr<NativeAppWindow> native_app_window_; |
519 scoped_ptr<AppWindowContents> app_window_contents_; | 515 scoped_ptr<AppWindowContents> app_window_contents_; |
520 scoped_ptr<AppDelegate> app_delegate_; | 516 scoped_ptr<AppDelegate> app_delegate_; |
521 scoped_ptr<Delegate> delegate_; | 517 scoped_ptr<Delegate> delegate_; |
| 518 scoped_ptr<AppWebContentsHelper> helper_; |
522 | 519 |
523 // Manages popup windows (bubbles, tab-modals) visible overlapping the | 520 // Manages popup windows (bubbles, tab-modals) visible overlapping the |
524 // app window. | 521 // app window. |
525 scoped_ptr<web_modal::PopupManager> popup_manager_; | 522 scoped_ptr<web_modal::PopupManager> popup_manager_; |
526 | 523 |
527 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; | 524 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; |
528 | 525 |
529 // Bit field of FullscreenType. | 526 // Bit field of FullscreenType. |
530 int fullscreen_types_; | 527 int fullscreen_types_; |
531 | 528 |
(...skipping 30 matching lines...) Expand all Loading... |
562 | 559 |
563 // Whether |transparent_background| was set in the CreateParams. | 560 // Whether |transparent_background| was set in the CreateParams. |
564 bool requested_transparent_background_; | 561 bool requested_transparent_background_; |
565 | 562 |
566 DISALLOW_COPY_AND_ASSIGN(AppWindow); | 563 DISALLOW_COPY_AND_ASSIGN(AppWindow); |
567 }; | 564 }; |
568 | 565 |
569 } // namespace apps | 566 } // namespace apps |
570 | 567 |
571 #endif // APPS_APP_WINDOW_H_ | 568 #endif // APPS_APP_WINDOW_H_ |
OLD | NEW |