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

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

Issue 1527043002: [Extensions] Don't use ExtensionInstallPrompt subclasses for auto-confirmation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // show. 315 // show.
316 // |extension| can be null in the case of a bndle install. 316 // |extension| can be null in the case of a bndle install.
317 // If |icon| is null, this will attempt to load the extension's icon. 317 // If |icon| is null, this will attempt to load the extension's icon.
318 // |prompt| is used to pass in a prompt with additional data (like retained 318 // |prompt| is used to pass in a prompt with additional data (like retained
319 // device permissions) or a different type. If not provided, |prompt| will 319 // device permissions) or a different type. If not provided, |prompt| will
320 // be created as an INSTALL_PROMPT. 320 // be created as an INSTALL_PROMPT.
321 // |custom_permissions| will be used if provided; otherwise, the extensions 321 // |custom_permissions| will be used if provided; otherwise, the extensions
322 // current permissions are used. 322 // current permissions are used.
323 // 323 //
324 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. 324 // We *MUST* eventually call either Proceed() or Abort() on |delegate|.
325 virtual void ShowDialog(Delegate* delegate, 325 void ShowDialog(Delegate* delegate,
326 const extensions::Extension* extension, 326 const extensions::Extension* extension,
327 const SkBitmap* icon, 327 const SkBitmap* icon,
328 const ShowDialogCallback& show_dialog_callback); 328 const ShowDialogCallback& show_dialog_callback);
329 virtual void ShowDialog(Delegate* delegate, 329 void ShowDialog(Delegate* delegate,
330 const extensions::Extension* extension, 330 const extensions::Extension* extension,
331 const SkBitmap* icon, 331 const SkBitmap* icon,
332 scoped_ptr<Prompt> prompt, 332 scoped_ptr<Prompt> prompt,
333 const ShowDialogCallback& show_dialog_callback); 333 const ShowDialogCallback& show_dialog_callback);
334 // Declared virtual for testing purposes.
335 // Note: if all you want to do is automatically confirm or cancel, prefer
336 // ScopedTestDialogAutoConfirm from extension_dialog_auto_confirm.h
334 virtual void ShowDialog( 337 virtual void ShowDialog(
335 Delegate* delegate, 338 Delegate* delegate,
336 const extensions::Extension* extension, 339 const extensions::Extension* extension,
337 const SkBitmap* icon, 340 const SkBitmap* icon,
338 scoped_ptr<Prompt> prompt, 341 scoped_ptr<Prompt> prompt,
339 scoped_ptr<const extensions::PermissionSet> custom_permissions, 342 scoped_ptr<const extensions::PermissionSet> custom_permissions,
340 const ShowDialogCallback& show_dialog_callback); 343 const ShowDialogCallback& show_dialog_callback);
341 344
342 // Installation was successful. This is declared virtual for testing. 345 // Installation was successful. This is declared virtual for testing.
343 virtual void OnInstallSuccess(const extensions::Extension* extension, 346 virtual void OnInstallSuccess(const extensions::Extension* extension,
344 SkBitmap* icon); 347 SkBitmap* icon);
345 348
346 // Installation failed. This is declared virtual for testing. 349 // Installation failed. This is declared virtual for testing.
347 virtual void OnInstallFailure(const extensions::CrxInstallError& error); 350 virtual void OnInstallFailure(const extensions::CrxInstallError& error);
348 351
352 bool did_call_show_dialog() const { return did_call_show_dialog_; }
353
349 protected: 354 protected:
350 friend class extensions::ExtensionWebstorePrivateApiTest; 355 friend class extensions::ExtensionWebstorePrivateApiTest;
351 friend class WebstoreStartupInstallUnpackFailureTest; 356 friend class WebstoreStartupInstallUnpackFailureTest;
352 357
353 private: 358 private:
354 friend class GalleryInstallApiTestObserver; 359 friend class GalleryInstallApiTestObserver;
355 360
356 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains 361 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains
357 // an empty bitmap, then a default icon will be used instead. 362 // an empty bitmap, then a default icon will be used instead.
358 void SetIcon(const SkBitmap* icon); 363 void SetIcon(const SkBitmap* icon);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 396
392 // The delegate we will call Proceed/Abort on after confirmation UI. 397 // The delegate we will call Proceed/Abort on after confirmation UI.
393 Delegate* delegate_; 398 Delegate* delegate_;
394 399
395 // A pre-filled prompt. 400 // A pre-filled prompt.
396 scoped_ptr<Prompt> prompt_; 401 scoped_ptr<Prompt> prompt_;
397 402
398 // Used to show the confirm dialog. 403 // Used to show the confirm dialog.
399 ShowDialogCallback show_dialog_callback_; 404 ShowDialogCallback show_dialog_callback_;
400 405
406 // Whether or not the |show_dialog_callback_| was called.
407 bool did_call_show_dialog_;
408
401 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPrompt); 409 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPrompt);
402 }; 410 };
403 411
404 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 412 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/extension_install_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698