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_JAVASCRIPT_DIALOGS_EXTENSIONS_CLIENT_H_
6 #define COMPONENTS_JAVASCRIPT_DIALOGS_EXTENSIONS_CLIENT_H_
7 
8 #include <string>
9 
10 class GURL;
11 
12 namespace content {
13 class WebContents;
14 }
15 
16 namespace javascript_dialogs {
17 
18 // A client interface to access and control extensions/apps
19 // that opened a JavaScript dialog.
20 class ExtensionsClient {
21  public:
~ExtensionsClient()22   virtual ~ExtensionsClient() {}
23 
24   // Called when the extension associated with |web_contents| opened
25   // a dialog.
26   virtual void OnDialogOpened(content::WebContents* web_contents) = 0;
27 
28   // Called when a dialog created by the extension associated with
29   // |web_contents| is closed.
30   virtual void OnDialogClosed(content::WebContents* web_contents) = 0;
31 
32   // Sets the name of the extensions associated with the
33   // |web_contents| in the |name_out| if there is one, returning true;
34   // returns false otherwise.
35   virtual bool GetExtensionName(content::WebContents* web_contents,
36                                 const GURL& alerting_frame_url,
37                                 std::string* name_out) = 0;
38 };
39 
40 }  // namespace javascript_dialogs
41 
42 #endif  // COMPONENTS_JAVASCRIPT_DIALOGS_EXTENSIONS_CLIENT_H_
43