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

Side by Side Diff: chrome/browser/extensions/external_install_error.cc

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/extensions/external_install_error.h" 5 #include "chrome/browser/extensions/external_install_error.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" 14 #include "chrome/browser/extensions/extension_install_prompt_show_params.h"
14 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/external_install_manager.h" 16 #include "chrome/browser/extensions/external_install_manager.h"
16 #include "chrome/browser/extensions/webstore_data_fetcher.h" 17 #include "chrome/browser/extensions/webstore_data_fetcher.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 330
330 void ExternalInstallError::ShowDialog(Browser* browser) { 331 void ExternalInstallError::ShowDialog(Browser* browser) {
331 DCHECK(install_ui_.get()); 332 DCHECK(install_ui_.get());
332 DCHECK(prompt_.get()); 333 DCHECK(prompt_.get());
333 DCHECK(browser); 334 DCHECK(browser);
334 content::WebContents* web_contents = NULL; 335 content::WebContents* web_contents = NULL;
335 web_contents = browser->tab_strip_model()->GetActiveWebContents(); 336 web_contents = browser->tab_strip_model()->GetActiveWebContents();
336 install_ui_show_params_.reset( 337 install_ui_show_params_.reset(
337 new ExtensionInstallPromptShowParams(web_contents)); 338 new ExtensionInstallPromptShowParams(web_contents));
338 ExtensionInstallPrompt::GetDefaultShowDialogCallback().Run( 339 ExtensionInstallPrompt::GetDefaultShowDialogCallback().Run(
339 install_ui_show_params_.get(), this, prompt_.Pass()); 340 install_ui_show_params_.get(), this, std::move(prompt_));
340 } 341 }
341 342
342 const Extension* ExternalInstallError::GetExtension() const { 343 const Extension* ExternalInstallError::GetExtension() const {
343 return ExtensionRegistry::Get(browser_context_) 344 return ExtensionRegistry::Get(browser_context_)
344 ->GetExtensionById(extension_id_, ExtensionRegistry::EVERYTHING); 345 ->GetExtensionById(extension_id_, ExtensionRegistry::EVERYTHING);
345 } 346 }
346 347
347 void ExternalInstallError::OnWebstoreRequestFailure() { 348 void ExternalInstallError::OnWebstoreRequestFailure() {
348 OnFetchComplete(); 349 OnFetchComplete();
349 } 350 }
(...skipping 28 matching lines...) Expand all
378 void ExternalInstallError::OnFetchComplete() { 379 void ExternalInstallError::OnFetchComplete() {
379 // Create a new ExtensionInstallPrompt. We pass in NULL for the UI 380 // Create a new ExtensionInstallPrompt. We pass in NULL for the UI
380 // components because we display at a later point, and don't want 381 // components because we display at a later point, and don't want
381 // to pass ones which may be invalidated. 382 // to pass ones which may be invalidated.
382 install_ui_.reset( 383 install_ui_.reset(
383 new ExtensionInstallPrompt(Profile::FromBrowserContext(browser_context_), 384 new ExtensionInstallPrompt(Profile::FromBrowserContext(browser_context_),
384 NULL)); // NULL native window. 385 NULL)); // NULL native window.
385 386
386 install_ui_->ShowDialog(this, GetExtension(), 387 install_ui_->ShowDialog(this, GetExtension(),
387 nullptr, // Force a fetch of the icon. 388 nullptr, // Force a fetch of the icon.
388 prompt_.Pass(), 389 std::move(prompt_),
389 base::Bind(&ExternalInstallError::OnDialogReady, 390 base::Bind(&ExternalInstallError::OnDialogReady,
390 weak_factory_.GetWeakPtr())); 391 weak_factory_.GetWeakPtr()));
391 } 392 }
392 393
393 void ExternalInstallError::OnDialogReady( 394 void ExternalInstallError::OnDialogReady(
394 ExtensionInstallPromptShowParams* show_params, 395 ExtensionInstallPromptShowParams* show_params,
395 ExtensionInstallPrompt::Delegate* prompt_delegate, 396 ExtensionInstallPrompt::Delegate* prompt_delegate,
396 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) { 397 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) {
397 DCHECK_EQ(this, prompt_delegate); 398 DCHECK_EQ(this, prompt_delegate);
398 prompt_ = prompt.Pass(); 399 prompt_ = std::move(prompt);
399 400
400 if (alert_type_ == BUBBLE_ALERT) { 401 if (alert_type_ == BUBBLE_ALERT) {
401 global_error_.reset(new ExternalInstallBubbleAlert(this, prompt_.get())); 402 global_error_.reset(new ExternalInstallBubbleAlert(this, prompt_.get()));
402 error_service_->AddGlobalError(global_error_.get()); 403 error_service_->AddGlobalError(global_error_.get());
403 404
404 Browser* browser = 405 Browser* browser =
405 chrome::FindTabbedBrowser(Profile::FromBrowserContext(browser_context_), 406 chrome::FindTabbedBrowser(Profile::FromBrowserContext(browser_context_),
406 true, 407 true,
407 chrome::GetActiveDesktop()); 408 chrome::GetActiveDesktop());
408 if (browser) 409 if (browser)
409 global_error_->ShowBubbleView(browser); 410 global_error_->ShowBubbleView(browser);
410 } else { 411 } else {
411 DCHECK(alert_type_ == MENU_ALERT); 412 DCHECK(alert_type_ == MENU_ALERT);
412 global_error_.reset(new ExternalInstallMenuAlert(this)); 413 global_error_.reset(new ExternalInstallMenuAlert(this));
413 error_service_->AddGlobalError(global_error_.get()); 414 error_service_->AddGlobalError(global_error_.get());
414 } 415 }
415 } 416 }
416 417
417 } // namespace extensions 418 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_util.cc ('k') | chrome/browser/extensions/external_pref_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698