Home | History | Annotate | Download | only in ui
      1 // Copyright (c) 2012 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_UI_BROWSER_DIALOGS_H_
      6 #define CHROME_BROWSER_UI_BROWSER_DIALOGS_H_
      7 
      8 #include "base/callback.h"
      9 #include "chrome/browser/profiles/profile_window.h"
     10 #include "content/public/common/signed_certificate_timestamp_id_and_status.h"
     11 #include "ipc/ipc_message.h"  // For IPC_MESSAGE_LOG_ENABLED.
     12 #include "third_party/skia/include/core/SkColor.h"
     13 #include "ui/gfx/native_widget_types.h"
     14 
     15 class Browser;
     16 class Profile;
     17 class SkBitmap;
     18 class TabModalConfirmDialogDelegate;
     19 
     20 namespace content {
     21 class BrowserContext;
     22 class ColorChooser;
     23 class WebContents;
     24 }
     25 
     26 namespace extensions {
     27 class Extension;
     28 }
     29 
     30 namespace ui {
     31 class ProfileSigninConfirmationDelegate;
     32 class WebDialogDelegate;
     33 }
     34 
     35 namespace chrome {
     36 
     37 #if defined(IPC_MESSAGE_LOG_ENABLED)
     38 
     39 // The dialog is a singleton. If the dialog is already opened, it won't do
     40 // anything, so you can just blindly call this function all you want.
     41 // This is called from chrome/browser/browser_about_handler.cc
     42 void ShowAboutIPCDialog();
     43 
     44 #endif  // IPC_MESSAGE_LOG_ENABLED
     45 
     46 // Creates and shows an HTML dialog with the given delegate and context.
     47 // The window is automatically destroyed when it is closed.
     48 // Returns the created window.
     49 //
     50 // Make sure to use the returned window only when you know it is safe
     51 // to do so, i.e. before OnDialogClosed() is called on the delegate.
     52 gfx::NativeWindow ShowWebDialog(gfx::NativeWindow parent,
     53                                 content::BrowserContext* context,
     54                                 ui::WebDialogDelegate* delegate);
     55 
     56 // Shows the collected cookies dialog box.
     57 void ShowCollectedCookiesDialog(content::WebContents* web_contents);
     58 
     59 // Creates the ExtensionInstalledBubble and schedules it to be shown once
     60 // the extension has loaded. |extension| is the installed extension. |browser|
     61 // is the browser window which will host the bubble. |icon| is the install
     62 // icon of the extension.
     63 void ShowExtensionInstalledBubble(const extensions::Extension* extension,
     64                                   Browser* browser,
     65                                   const SkBitmap& icon);
     66 
     67 // Shows or hide the hung renderer dialog for the given WebContents.
     68 // We need to pass the WebContents to the dialog, because multiple tabs can hang
     69 // and it needs to keep track of which tabs are currently hung.
     70 void ShowHungRendererDialog(content::WebContents* contents);
     71 void HideHungRendererDialog(content::WebContents* contents);
     72 
     73 // Shows the Task Manager. |browser| can be NULL when called from Ash.
     74 void ShowTaskManager(Browser* browser);
     75 
     76 #if !defined(OS_MACOSX)
     77 // Shows the create web app shortcut dialog box.
     78 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window,
     79                                      content::WebContents* web_contents);
     80 #endif
     81 
     82 // Shows the create chrome app shortcut dialog box.
     83 // |close_callback| may be null.
     84 void ShowCreateChromeAppShortcutsDialog(
     85     gfx::NativeWindow parent_window,
     86     Profile* profile,
     87     const extensions::Extension* app,
     88     const base::Callback<void(bool /* created */)>& close_callback);
     89 
     90 // Shows a color chooser that reports to the given WebContents.
     91 content::ColorChooser* ShowColorChooser(content::WebContents* web_contents,
     92                                         SkColor initial_color);
     93 
     94 void ShowProfileSigninConfirmationDialog(
     95     Browser* browser,
     96     content::WebContents* web_contents,
     97     Profile* profile,
     98     const std::string& username,
     99     ui::ProfileSigninConfirmationDelegate* delegate);
    100 
    101 // Shows the Signed Certificate Timestamps viewer, to view the signed
    102 // certificate timestamps in |sct_ids_list|
    103 void ShowSignedCertificateTimestampsViewer(
    104     content::WebContents* web_contents,
    105     const content::SignedCertificateTimestampIDStatusList& sct_ids_list);
    106 
    107 // Shows the ManagePasswords bubble for a particular |web_contents|.
    108 void ShowManagePasswordsBubble(content::WebContents* web_contents);
    109 
    110 // Closes the bubble if it's shown for |web_contents|.
    111 void CloseManagePasswordsBubble(content::WebContents* web_contents);
    112 
    113 }  // namespace chrome
    114 
    115 #endif  // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_
    116