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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "extensions/common/permissions/permission_message.h" 20 #include "extensions/common/permissions/permission_message.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
23 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
24 24
25 class ExtensionInstallPromptShowParams; 25 class ExtensionInstallPromptShowParams;
26 class Profile; 26 class Profile;
27 27
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 enum class Result { 256 enum class Result {
257 ACCEPTED, 257 ACCEPTED,
258 USER_CANCELED, 258 USER_CANCELED,
259 ABORTED, 259 ABORTED,
260 }; 260 };
261 261
262 using DoneCallback = base::Callback<void(Result result)>; 262 using DoneCallback = base::Callback<void(Result result)>;
263 263
264 typedef base::Callback<void(ExtensionInstallPromptShowParams*, 264 typedef base::Callback<void(ExtensionInstallPromptShowParams*,
265 const DoneCallback&, 265 const DoneCallback&,
266 scoped_ptr<ExtensionInstallPrompt::Prompt>)> 266 std::unique_ptr<ExtensionInstallPrompt::Prompt>)>
267 ShowDialogCallback; 267 ShowDialogCallback;
268 268
269 // Callback to show the default extension install dialog. 269 // Callback to show the default extension install dialog.
270 // The implementations of this function are platform-specific. 270 // The implementations of this function are platform-specific.
271 static ShowDialogCallback GetDefaultShowDialogCallback(); 271 static ShowDialogCallback GetDefaultShowDialogCallback();
272 272
273 // Returns the appropriate prompt type for the given |extension|. 273 // Returns the appropriate prompt type for the given |extension|.
274 // TODO(devlin): This method is yucky - callers probably only care about one 274 // TODO(devlin): This method is yucky - callers probably only care about one
275 // prompt type. We just need to comb through and figure out what it is. 275 // prompt type. We just need to comb through and figure out what it is.
276 static PromptType GetReEnablePromptTypeForExtension( 276 static PromptType GetReEnablePromptTypeForExtension(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // current permissions are used. 313 // current permissions are used.
314 // 314 //
315 // The |install_callback| *MUST* eventually be called. 315 // The |install_callback| *MUST* eventually be called.
316 void ShowDialog(const DoneCallback& install_callback, 316 void ShowDialog(const DoneCallback& install_callback,
317 const extensions::Extension* extension, 317 const extensions::Extension* extension,
318 const SkBitmap* icon, 318 const SkBitmap* icon,
319 const ShowDialogCallback& show_dialog_callback); 319 const ShowDialogCallback& show_dialog_callback);
320 void ShowDialog(const DoneCallback& install_callback, 320 void ShowDialog(const DoneCallback& install_callback,
321 const extensions::Extension* extension, 321 const extensions::Extension* extension,
322 const SkBitmap* icon, 322 const SkBitmap* icon,
323 scoped_ptr<Prompt> prompt, 323 std::unique_ptr<Prompt> prompt,
324 const ShowDialogCallback& show_dialog_callback); 324 const ShowDialogCallback& show_dialog_callback);
325 // Declared virtual for testing purposes. 325 // Declared virtual for testing purposes.
326 // Note: if all you want to do is automatically confirm or cancel, prefer 326 // Note: if all you want to do is automatically confirm or cancel, prefer
327 // ScopedTestDialogAutoConfirm from extension_dialog_auto_confirm.h 327 // ScopedTestDialogAutoConfirm from extension_dialog_auto_confirm.h
328 virtual void ShowDialog( 328 virtual void ShowDialog(
329 const DoneCallback& install_callback, 329 const DoneCallback& install_callback,
330 const extensions::Extension* extension, 330 const extensions::Extension* extension,
331 const SkBitmap* icon, 331 const SkBitmap* icon,
332 scoped_ptr<Prompt> prompt, 332 std::unique_ptr<Prompt> prompt,
333 scoped_ptr<const extensions::PermissionSet> custom_permissions, 333 std::unique_ptr<const extensions::PermissionSet> custom_permissions,
334 const ShowDialogCallback& show_dialog_callback); 334 const ShowDialogCallback& show_dialog_callback);
335 335
336 // Installation was successful. This is declared virtual for testing. 336 // Installation was successful. This is declared virtual for testing.
337 virtual void OnInstallSuccess(const extensions::Extension* extension, 337 virtual void OnInstallSuccess(const extensions::Extension* extension,
338 SkBitmap* icon); 338 SkBitmap* icon);
339 339
340 // Installation failed. This is declared virtual for testing. 340 // Installation failed. This is declared virtual for testing.
341 virtual void OnInstallFailure(const extensions::CrxInstallError& error); 341 virtual void OnInstallFailure(const extensions::CrxInstallError& error);
342 342
343 bool did_call_show_dialog() const { return did_call_show_dialog_; } 343 bool did_call_show_dialog() const { return did_call_show_dialog_; }
(...skipping 20 matching lines...) Expand all
364 364
365 // The extensions installation icon. 365 // The extensions installation icon.
366 SkBitmap icon_; 366 SkBitmap icon_;
367 367
368 // The extension we are showing the UI for, if type is not 368 // The extension we are showing the UI for, if type is not
369 // BUNDLE_INSTALL_PROMPT or DELEGATED_BUNDLE_PERMISSIONS_PROMPT. 369 // BUNDLE_INSTALL_PROMPT or DELEGATED_BUNDLE_PERMISSIONS_PROMPT.
370 const extensions::Extension* extension_; 370 const extensions::Extension* extension_;
371 371
372 // A custom set of permissions to show in the install prompt instead of the 372 // A custom set of permissions to show in the install prompt instead of the
373 // extension's active permissions. 373 // extension's active permissions.
374 scoped_ptr<const extensions::PermissionSet> custom_permissions_; 374 std::unique_ptr<const extensions::PermissionSet> custom_permissions_;
375 375
376 // The object responsible for doing the UI specific actions. 376 // The object responsible for doing the UI specific actions.
377 scoped_ptr<extensions::ExtensionInstallUI> install_ui_; 377 std::unique_ptr<extensions::ExtensionInstallUI> install_ui_;
378 378
379 // Parameters to show the confirmation UI. 379 // Parameters to show the confirmation UI.
380 scoped_ptr<ExtensionInstallPromptShowParams> show_params_; 380 std::unique_ptr<ExtensionInstallPromptShowParams> show_params_;
381 381
382 // The callback to run with the result. 382 // The callback to run with the result.
383 DoneCallback done_callback_; 383 DoneCallback done_callback_;
384 384
385 // A pre-filled prompt. 385 // A pre-filled prompt.
386 scoped_ptr<Prompt> prompt_; 386 std::unique_ptr<Prompt> prompt_;
387 387
388 // Used to show the confirm dialog. 388 // Used to show the confirm dialog.
389 ShowDialogCallback show_dialog_callback_; 389 ShowDialogCallback show_dialog_callback_;
390 390
391 // Whether or not the |show_dialog_callback_| was called. 391 // Whether or not the |show_dialog_callback_| was called.
392 bool did_call_show_dialog_; 392 bool did_call_show_dialog_;
393 393
394 base::WeakPtrFactory<ExtensionInstallPrompt> weak_factory_; 394 base::WeakPtrFactory<ExtensionInstallPrompt> weak_factory_;
395 395
396 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPrompt); 396 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPrompt);
397 }; 397 };
398 398
399 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 399 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698