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

Side by Side Diff: chrome/browser/extensions/theme_installed_infobar_delegate.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, 12 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 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" 5 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8
9 #include <string> 8 #include <string>
9 #include <utility>
10 10
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/infobars/infobar_service.h" 15 #include "chrome/browser/infobars/infobar_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/themes/theme_service.h" 17 #include "chrome/browser/themes/theme_service.h"
18 #include "chrome/browser/themes/theme_service_factory.h" 18 #include "chrome/browser/themes/theme_service_factory.h"
19 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // new one. 63 // new one.
64 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { 64 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
65 infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); 65 infobars::InfoBar* old_infobar = infobar_service->infobar_at(i);
66 ThemeInstalledInfoBarDelegate* theme_infobar = 66 ThemeInstalledInfoBarDelegate* theme_infobar =
67 old_infobar->delegate()->AsThemePreviewInfobarDelegate(); 67 old_infobar->delegate()->AsThemePreviewInfobarDelegate();
68 if (theme_infobar) { 68 if (theme_infobar) {
69 // If the user installed the same theme twice, ignore the second install 69 // If the user installed the same theme twice, ignore the second install
70 // and keep the first install info bar, so that they can easily undo to 70 // and keep the first install info bar, so that they can easily undo to
71 // get back the previous theme. 71 // get back the previous theme.
72 if (theme_infobar->theme_id_ != new_theme->id()) { 72 if (theme_infobar->theme_id_ != new_theme->id()) {
73 infobar_service->ReplaceInfoBar(old_infobar, new_infobar.Pass()); 73 infobar_service->ReplaceInfoBar(old_infobar, std::move(new_infobar));
74 theme_service->OnInfobarDisplayed(); 74 theme_service->OnInfobarDisplayed();
75 } 75 }
76 return; 76 return;
77 } 77 }
78 } 78 }
79 79
80 // No previous theme infobar, so add this. 80 // No previous theme infobar, so add this.
81 infobar_service->AddInfoBar(new_infobar.Pass()); 81 infobar_service->AddInfoBar(std::move(new_infobar));
82 theme_service->OnInfobarDisplayed(); 82 theme_service->OnInfobarDisplayed();
83 } 83 }
84 84
85 ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( 85 ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate(
86 ExtensionService* extension_service, 86 ExtensionService* extension_service,
87 ThemeService* theme_service, 87 ThemeService* theme_service,
88 const extensions::Extension* new_theme, 88 const extensions::Extension* new_theme,
89 const std::string& previous_theme_id, 89 const std::string& previous_theme_id,
90 bool previous_using_system_theme) 90 bool previous_using_system_theme)
91 : ConfirmInfoBarDelegate(), 91 : ConfirmInfoBarDelegate(),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 void ThemeInstalledInfoBarDelegate::Observe( 163 void ThemeInstalledInfoBarDelegate::Observe(
164 int type, 164 int type,
165 const content::NotificationSource& source, 165 const content::NotificationSource& source,
166 const content::NotificationDetails& details) { 166 const content::NotificationDetails& details) {
167 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); 167 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type);
168 // If the new theme is different from what this info bar is associated with, 168 // If the new theme is different from what this info bar is associated with,
169 // close this info bar since it is no longer relevant. 169 // close this info bar since it is no longer relevant.
170 if (theme_id_ != theme_service_->GetThemeID()) 170 if (theme_id_ != theme_service_->GetThemeID())
171 infobar()->RemoveSelf(); 171 infobar()->RemoveSelf();
172 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698