OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_SHOW_PARAMS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_SHOW_PARAMS_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/gfx/native_widget_types.h" |
| 10 |
| 11 class NativeWindowTracker; |
| 12 class Profile; |
| 13 |
| 14 namespace content { |
| 15 class WebContents; |
| 16 } |
| 17 |
| 18 // Parameters to show an install prompt dialog. The parameters control: |
| 19 // - The dialog's parent window |
| 20 // - The browser window to use to open a new tab if a user clicks a link in the |
| 21 // dialog. |
| 22 class ExtensionInstallPromptShowParams { |
| 23 public: |
| 24 explicit ExtensionInstallPromptShowParams(content::WebContents* web_contents); |
| 25 |
| 26 // The most recently active browser window (or a new browser window if there |
| 27 // are no browser windows) is used if a new tab needs to be opened. |
| 28 ExtensionInstallPromptShowParams(Profile* profile, gfx::NativeWindow window); |
| 29 |
| 30 virtual ~ExtensionInstallPromptShowParams(); |
| 31 |
| 32 Profile* profile() { |
| 33 return profile_; |
| 34 } |
| 35 |
| 36 // The parent web contents for the dialog. Returns NULL if the web contents |
| 37 // have been destroyed. |
| 38 content::WebContents* GetParentWebContents(); |
| 39 |
| 40 // The parent window for the dialog. Returns NULL if the window has been |
| 41 // destroyed. |
| 42 gfx::NativeWindow GetParentWindow(); |
| 43 |
| 44 // Returns true if either the parent web contents or the parent window were |
| 45 // destroyed. |
| 46 bool WasParentDestroyed(); |
| 47 |
| 48 private: |
| 49 void WebContentsDestroyed(); |
| 50 |
| 51 Profile* profile_; |
| 52 content::WebContents* parent_web_contents_; |
| 53 bool parent_web_contents_destroyed_; |
| 54 gfx::NativeWindow parent_window_; |
| 55 |
| 56 class WebContentsDestructionObserver; |
| 57 scoped_ptr<WebContentsDestructionObserver> web_contents_destruction_observer_; |
| 58 |
| 59 scoped_ptr<NativeWindowTracker> native_window_tracker_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPromptShowParams); |
| 62 }; |
| 63 |
| 64 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_SHOW_PARAMS_H_ |
OLD | NEW |