Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.h

Issue 660643002: [Refactor] Move creating a browser if necessary to ExtensionInstallDialogView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 12 matching lines...) Expand all
23 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
24 24
25 class Profile; 25 class Profile;
26 26
27 namespace base { 27 namespace base {
28 class DictionaryValue; 28 class DictionaryValue;
29 class MessageLoop; 29 class MessageLoop;
30 } // namespace base 30 } // namespace base
31 31
32 namespace content { 32 namespace content {
33 class PageNavigator;
34 class WebContents; 33 class WebContents;
35 } 34 }
36 35
37 namespace extensions { 36 namespace extensions {
38 class BundleInstaller; 37 class BundleInstaller;
39 class CrxInstallerError; 38 class CrxInstallerError;
40 class Extension; 39 class Extension;
41 class ExtensionInstallUI; 40 class ExtensionInstallUI;
42 class ExtensionWebstorePrivateApiTest; 41 class ExtensionWebstorePrivateApiTest;
43 class MockGetAuthTokenFunction; 42 class MockGetAuthTokenFunction;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // We call this method to signal that the installation should stop, with 274 // We call this method to signal that the installation should stop, with
276 // |user_initiated| true if the installation was stopped by the user. 275 // |user_initiated| true if the installation was stopped by the user.
277 virtual void InstallUIAbort(bool user_initiated) = 0; 276 virtual void InstallUIAbort(bool user_initiated) = 0;
278 277
279 protected: 278 protected:
280 virtual ~Delegate() {} 279 virtual ~Delegate() {}
281 }; 280 };
282 281
283 // Parameters to show a prompt dialog. Two sets of the 282 // Parameters to show a prompt dialog. Two sets of the
284 // parameters are supported: either use a parent WebContents or use a 283 // parameters are supported: either use a parent WebContents or use a
285 // parent NativeWindow + a PageNavigator. 284 // parent NativeWindow + a Profile.
286 struct ShowParams { 285 struct ShowParams {
287 explicit ShowParams(content::WebContents* contents); 286 explicit ShowParams(content::WebContents* contents);
288 ShowParams(gfx::NativeWindow window, content::PageNavigator* navigator); 287 ShowParams(Profile* profile, gfx::NativeWindow window);
288
289 Profile* profile;
289 290
290 // Parent web contents of the install UI dialog. This can be NULL. 291 // Parent web contents of the install UI dialog. This can be NULL.
291 content::WebContents* parent_web_contents; 292 content::WebContents* parent_web_contents;
292 293
293 // NativeWindow parent and navigator. If initialized using a parent web 294 // NativeWindow parent.
294 // contents, these are derived from it.
295 gfx::NativeWindow parent_window; 295 gfx::NativeWindow parent_window;
296 content::PageNavigator* navigator;
297 }; 296 };
298 297
299 typedef base::Callback<void(const ExtensionInstallPrompt::ShowParams&, 298 typedef base::Callback<void(const ExtensionInstallPrompt::ShowParams&,
300 ExtensionInstallPrompt::Delegate*, 299 ExtensionInstallPrompt::Delegate*,
301 scoped_refptr<ExtensionInstallPrompt::Prompt>)> 300 scoped_refptr<ExtensionInstallPrompt::Prompt>)>
302 ShowDialogCallback; 301 ShowDialogCallback;
303 302
304 // Callback to show the default extension install dialog. 303 // Callback to show the default extension install dialog.
305 // The implementations of this function are platform-specific. 304 // The implementations of this function are platform-specific.
306 static ShowDialogCallback GetDefaultShowDialogCallback(); 305 static ShowDialogCallback GetDefaultShowDialogCallback();
307 306
308 // Creates a dummy extension from the |manifest|, replacing the name and 307 // Creates a dummy extension from the |manifest|, replacing the name and
309 // description with the localizations if provided. 308 // description with the localizations if provided.
310 static scoped_refptr<extensions::Extension> GetLocalizedExtensionForDisplay( 309 static scoped_refptr<extensions::Extension> GetLocalizedExtensionForDisplay(
311 const base::DictionaryValue* manifest, 310 const base::DictionaryValue* manifest,
312 int flags, // Extension::InitFromValueFlags 311 int flags, // Extension::InitFromValueFlags
313 const std::string& id, 312 const std::string& id,
314 const std::string& localized_name, 313 const std::string& localized_name,
315 const std::string& localized_description, 314 const std::string& localized_description,
316 std::string* error); 315 std::string* error);
317 316
318 // Creates a prompt with a parent web content. 317 // Creates a prompt with a parent web content.
319 explicit ExtensionInstallPrompt(content::WebContents* contents); 318 explicit ExtensionInstallPrompt(content::WebContents* contents);
320 319
321 // Creates a prompt with a profile, a native window and a page navigator. 320 // Creates a prompt with a profile and a native window. The most recently
322 ExtensionInstallPrompt(Profile* profile, 321 // active browser window (or a new browser window if there are no browser
323 gfx::NativeWindow native_window, 322 // windows) is used if a new tab needs to be opened.
324 content::PageNavigator* navigator); 323 ExtensionInstallPrompt(Profile* profile, gfx::NativeWindow native_window);
325 324
326 virtual ~ExtensionInstallPrompt(); 325 virtual ~ExtensionInstallPrompt();
327 326
328 extensions::ExtensionInstallUI* install_ui() const { 327 extensions::ExtensionInstallUI* install_ui() const {
329 return install_ui_.get(); 328 return install_ui_.get();
330 } 329 }
331 330
332 content::WebContents* parent_web_contents() const { 331 content::WebContents* parent_web_contents() const {
333 return show_params_.parent_web_contents; 332 return show_params_.parent_web_contents;
334 } 333 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 Delegate* delegate_; 468 Delegate* delegate_;
470 469
471 // A pre-filled prompt. 470 // A pre-filled prompt.
472 scoped_refptr<Prompt> prompt_; 471 scoped_refptr<Prompt> prompt_;
473 472
474 // Used to show the confirm dialog. 473 // Used to show the confirm dialog.
475 ShowDialogCallback show_dialog_callback_; 474 ShowDialogCallback show_dialog_callback_;
476 }; 475 };
477 476
478 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 477 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
OLDNEW
« no previous file with comments | « chrome/browser/apps/ephemeral_app_launcher.cc ('k') | chrome/browser/extensions/extension_install_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698