15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_BROWSER_DIALOGS_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_BROWSER_DIALOGS_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/callback.h"
923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "chrome/browser/profiles/profile_window.h"
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/common/signed_certificate_timestamp_id_and_status.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ipc/ipc_message.h"  // For IPC_MESSAGE_LOG_ENABLED.
1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "third_party/skia/include/core/SkColor.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/native_widget_types.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Browser;
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class Profile;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SkBitmap;
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TabModalConfirmDialogDelegate;
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserContext;
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class ColorChooser;
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebContents;
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace extensions {
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Extension;
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ui {
31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class ProfileSigninConfirmationDelegate;
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebDialogDelegate;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace chrome {
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(IPC_MESSAGE_LOG_ENABLED)
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The dialog is a singleton. If the dialog is already opened, it won't do
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// anything, so you can just blindly call this function all you want.
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This is called from chrome/browser/browser_about_handler.cc
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void ShowAboutIPCDialog();
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // IPC_MESSAGE_LOG_ENABLED
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Creates and shows an HTML dialog with the given delegate and context.
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The window is automatically destroyed when it is closed.
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns the created window.
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Make sure to use the returned window only when you know it is safe
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// to do so, i.e. before OnDialogClosed() is called on the delegate.
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)gfx::NativeWindow ShowWebDialog(gfx::NativeWindow parent,
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                content::BrowserContext* context,
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                ui::WebDialogDelegate* delegate);
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Shows the collected cookies dialog box.
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void ShowCollectedCookiesDialog(content::WebContents* web_contents);
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Creates the ExtensionInstalledBubble and schedules it to be shown once
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the extension has loaded. |extension| is the installed extension. |browser|
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// is the browser window which will host the bubble. |icon| is the install
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// icon of the extension.
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void ShowExtensionInstalledBubble(const extensions::Extension* extension,
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                  Browser* browser,
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                  const SkBitmap& icon);
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Shows or hide the hung renderer dialog for the given WebContents.
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// We need to pass the WebContents to the dialog, because multiple tabs can hang
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// and it needs to keep track of which tabs are currently hung.
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void ShowHungRendererDialog(content::WebContents* contents);
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void HideHungRendererDialog(content::WebContents* contents);
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
73eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch// Shows the Task Manager. |browser| can be NULL when called from Ash.
74eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochvoid ShowTaskManager(Browser* browser);
752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if !defined(OS_MACOSX)
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Shows the create web app shortcut dialog box.
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window,
792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                     content::WebContents* web_contents);
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
828bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Shows the create chrome app shortcut dialog box.
838bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// |close_callback| may be null.
84010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)void ShowCreateChromeAppShortcutsDialog(
85010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)    gfx::NativeWindow parent_window,
86010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)    Profile* profile,
87010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)    const extensions::Extension* app,
88010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)    const base::Callback<void(bool /* created */)>& close_callback);
898bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
9090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Shows a color chooser that reports to the given WebContents.
9190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)content::ColorChooser* ShowColorChooser(content::WebContents* web_contents,
9290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                        SkColor initial_color);
9390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
94868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)void ShowProfileSigninConfirmationDialog(
95868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    Browser* browser,
96868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    content::WebContents* web_contents,
97868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    Profile* profile,
98868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    const std::string& username,
99868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    ui::ProfileSigninConfirmationDelegate* delegate);
100868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
1015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Shows the Signed Certificate Timestamps viewer, to view the signed
1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// certificate timestamps in |sct_ids_list|
1035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void ShowSignedCertificateTimestampsViewer(
1045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    content::WebContents* web_contents,
1055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const content::SignedCertificateTimestampIDStatusList& sct_ids_list);
1065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
107010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)// Shows the ManagePasswords bubble for a particular |web_contents|.
108010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)void ShowManagePasswordsBubble(content::WebContents* web_contents);
1091320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
1101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// Closes the bubble if it's shown for |web_contents|.
1111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccivoid CloseManagePasswordsBubble(content::WebContents* web_contents);
112010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace chrome
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_
116