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

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 14 matching lines...) Expand all
25 25
26 class ExtensionInstallUI; 26 class ExtensionInstallUI;
27 class Profile; 27 class Profile;
28 28
29 namespace base { 29 namespace base {
30 class DictionaryValue; 30 class DictionaryValue;
31 class MessageLoop; 31 class MessageLoop;
32 } // namespace base 32 } // namespace base
33 33
34 namespace content { 34 namespace content {
35 class PageNavigator;
36 class WebContents; 35 class WebContents;
37 } 36 }
38 37
39 namespace extensions { 38 namespace extensions {
40 class BundleInstaller; 39 class BundleInstaller;
41 class Extension; 40 class Extension;
42 class ExtensionWebstorePrivateApiTest; 41 class ExtensionWebstorePrivateApiTest;
43 class MockGetAuthTokenFunction; 42 class MockGetAuthTokenFunction;
44 class PermissionSet; 43 class PermissionSet;
45 } // namespace extensions 44 } // namespace extensions
(...skipping 229 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 ExtensionInstallUI* install_ui() const { return install_ui_.get(); } 327 ExtensionInstallUI* install_ui() const { return install_ui_.get(); }
329 328
330 content::WebContents* parent_web_contents() const { 329 content::WebContents* parent_web_contents() const {
331 return show_params_.parent_web_contents; 330 return show_params_.parent_web_contents;
332 } 331 }
333 332
334 // This is called by the bundle installer to verify whether the bundle 333 // This is called by the bundle installer to verify whether the bundle
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 Delegate* delegate_; 464 Delegate* delegate_;
466 465
467 // A pre-filled prompt. 466 // A pre-filled prompt.
468 scoped_refptr<Prompt> prompt_; 467 scoped_refptr<Prompt> prompt_;
469 468
470 // Used to show the confirm dialog. 469 // Used to show the confirm dialog.
471 ShowDialogCallback show_dialog_callback_; 470 ShowDialogCallback show_dialog_callback_;
472 }; 471 };
473 472
474 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 473 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698