| 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 COMPONENTS_APP_MODAL_DIALOGS_JAVASCRIPT_DIALOG_MANAGER_CLIENT_H_ | 
 |   6 #define COMPONENTS_APP_MODAL_DIALOGS_JAVASCRIPT_DIALOG_MANAGER_CLIENT_H_ | 
 |   7  | 
 |   8 #include <string> | 
 |   9  | 
 |  10 #include "base/memory/scoped_ptr.h" | 
 |  11 #include "ui/gfx/native_widget_types.h" | 
 |  12  | 
 |  13 class GURL; | 
 |  14 class NativeAppModalDialog; | 
 |  15 class JavaScriptAppModalDialog; | 
 |  16  | 
 |  17 namespace content { | 
 |  18 class WebContents; | 
 |  19 } | 
 |  20  | 
 |  21 class JavaScriptDialogManagerClient { | 
 |  22  public: | 
 |  23   virtual ~JavaScriptDialogManagerClient() {} | 
 |  24  | 
 |  25   // Creates an app modal dialog for a JavaScript prompt; | 
 |  26   virtual NativeAppModalDialog* CreateNativeJavaScriptPrompt( | 
 |  27       JavaScriptAppModalDialog* dialog, | 
 |  28       gfx::NativeWindow parent_window) = 0; | 
 |  29  | 
 |  30   // Called when the extension associated with |web_contents| opened | 
 |  31   // a dialog. The embedder should increment its keep alive count so | 
 |  32   // that its lazy background page can stay alive. | 
 |  33   virtual void IncrementLazyKeepaliveCount( | 
 |  34       content::WebContents* web_contents) = 0; | 
 |  35  | 
 |  36   // Called when a dialog created by the extension associated with | 
 |  37   // |web_contents| is closed. The embedder should decrement | 
 |  38   // its keep alive count so that the extension can shutdown | 
 |  39   // its lazy background page. | 
 |  40   virtual void DecrementLazyKeepaliveCount( | 
 |  41       content::WebContents* web_contents) = 0; | 
 |  42  | 
 |  43   // Sets the name of the extensions associated with the |web_contents| | 
 |  44   // in the |name_out|, and returns true. If there is no extension associated | 
 |  45   // with the |web_contents|, returns false. | 
 |  46   virtual bool GetExtensionName(content::WebContents* web_contents, | 
 |  47                                 const GURL& origin_url, | 
 |  48                                 std::string* name_out) = 0; | 
 |  49 }; | 
 |  50  | 
 |  51 void SetJavaScriptDialogManagerClient( | 
 |  52     scoped_ptr<JavaScriptDialogManagerClient> client); | 
 |  53  | 
 |  54 JavaScriptDialogManagerClient* GetJavaScriptDialogManagerClient(); | 
 |  55  | 
 |  56 #endif  // COMPONENTS_APP_MODAL_DIALOGS_JAVASCRIPT_DIALOG_MANAGER_CLIENT_H_ | 
| OLD | NEW |