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

Side by Side Diff: chrome/browser/ui/extensions/extension_action_view_controller.cc

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 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/ui/extensions/extension_action_view_controller.h" 5 #include "chrome/browser/ui/extensions/extension_action_view_controller.h"
6 6
7 #include <utility>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/api/commands/command_service.h" 11 #include "chrome/browser/extensions/api/commands/command_service.h"
10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 12 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
11 #include "chrome/browser/extensions/extension_action.h" 13 #include "chrome/browser/extensions/extension_action.h"
12 #include "chrome/browser/extensions/extension_view.h" 14 #include "chrome/browser/extensions/extension_view.h"
13 #include "chrome/browser/extensions/extension_view_host.h" 15 #include "chrome/browser/extensions/extension_view_host.h"
14 #include "chrome/browser/extensions/extension_view_host_factory.h" 16 #include "chrome/browser/extensions/extension_view_host_factory.h"
15 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/sessions/session_tab_helper.h" 18 #include "chrome/browser/sessions/session_tab_helper.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 if (toolbar_actions_bar_) 316 if (toolbar_actions_bar_)
315 toolbar_actions_bar_->SetPopupOwner(this); 317 toolbar_actions_bar_->SetPopupOwner(this);
316 318
317 if (toolbar_actions_bar_ && 319 if (toolbar_actions_bar_ &&
318 !toolbar_actions_bar_->IsActionVisibleOnMainBar(this) && 320 !toolbar_actions_bar_->IsActionVisibleOnMainBar(this) &&
319 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { 321 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) {
320 platform_delegate_->CloseOverflowMenu(); 322 platform_delegate_->CloseOverflowMenu();
321 toolbar_actions_bar_->PopOutAction( 323 toolbar_actions_bar_->PopOutAction(
322 this, 324 this,
323 base::Bind(&ExtensionActionViewController::ShowPopup, 325 base::Bind(&ExtensionActionViewController::ShowPopup,
324 weak_factory_.GetWeakPtr(), 326 weak_factory_.GetWeakPtr(), base::Passed(std::move(host)),
325 base::Passed(host.Pass()), 327 grant_tab_permissions, show_action));
326 grant_tab_permissions,
327 show_action));
328 } else { 328 } else {
329 ShowPopup(host.Pass(), grant_tab_permissions, show_action); 329 ShowPopup(std::move(host), grant_tab_permissions, show_action);
330 } 330 }
331 331
332 return true; 332 return true;
333 } 333 }
334 334
335 void ExtensionActionViewController::ShowPopup( 335 void ExtensionActionViewController::ShowPopup(
336 scoped_ptr<extensions::ExtensionViewHost> popup_host, 336 scoped_ptr<extensions::ExtensionViewHost> popup_host,
337 bool grant_tab_permissions, 337 bool grant_tab_permissions,
338 PopupShowAction show_action) { 338 PopupShowAction show_action) {
339 // It's possible that the popup should be closed before it finishes opening 339 // It's possible that the popup should be closed before it finishes opening
340 // (since it can open asynchronously). Check before proceeding. 340 // (since it can open asynchronously). Check before proceeding.
341 if (!popup_host_) 341 if (!popup_host_)
342 return; 342 return;
343 platform_delegate_->ShowPopup( 343 platform_delegate_->ShowPopup(std::move(popup_host), grant_tab_permissions,
344 popup_host.Pass(), grant_tab_permissions, show_action); 344 show_action);
345 view_delegate_->OnPopupShown(grant_tab_permissions); 345 view_delegate_->OnPopupShown(grant_tab_permissions);
346 } 346 }
347 347
348 void ExtensionActionViewController::OnPopupClosed() { 348 void ExtensionActionViewController::OnPopupClosed() {
349 popup_host_observer_.Remove(popup_host_); 349 popup_host_observer_.Remove(popup_host_);
350 popup_host_ = nullptr; 350 popup_host_ = nullptr;
351 if (toolbar_actions_bar_) { 351 if (toolbar_actions_bar_) {
352 toolbar_actions_bar_->SetPopupOwner(nullptr); 352 toolbar_actions_bar_->SetPopupOwner(nullptr);
353 if (toolbar_actions_bar_->popped_out_action() == this && 353 if (toolbar_actions_bar_->popped_out_action() == this &&
354 !view_delegate_->IsMenuRunning()) 354 !view_delegate_->IsMenuRunning())
(...skipping 13 matching lines...) Expand all
368 image_source->SetIcon(icon_factory_.GetIcon(tab_id)); 368 image_source->SetIcon(icon_factory_.GetIcon(tab_id));
369 369
370 scoped_ptr<IconWithBadgeImageSource::Badge> badge; 370 scoped_ptr<IconWithBadgeImageSource::Badge> badge;
371 std::string badge_text = extension_action_->GetBadgeText(tab_id); 371 std::string badge_text = extension_action_->GetBadgeText(tab_id);
372 if (!badge_text.empty()) { 372 if (!badge_text.empty()) {
373 badge.reset(new IconWithBadgeImageSource::Badge( 373 badge.reset(new IconWithBadgeImageSource::Badge(
374 badge_text, 374 badge_text,
375 extension_action_->GetBadgeTextColor(tab_id), 375 extension_action_->GetBadgeTextColor(tab_id),
376 extension_action_->GetBadgeBackgroundColor(tab_id))); 376 extension_action_->GetBadgeBackgroundColor(tab_id)));
377 } 377 }
378 image_source->SetBadge(badge.Pass()); 378 image_source->SetBadge(std::move(badge));
379 379
380 // Greyscaling disabled actions and having a special wants-to-run decoration 380 // Greyscaling disabled actions and having a special wants-to-run decoration
381 // are gated on the toolbar redesign. 381 // are gated on the toolbar redesign.
382 if (extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { 382 if (extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) {
383 // If the extension doesn't want to run on the active web contents, we 383 // If the extension doesn't want to run on the active web contents, we
384 // grayscale it to indicate that. 384 // grayscale it to indicate that.
385 image_source->set_grayscale(!IsEnabled(web_contents)); 385 image_source->set_grayscale(!IsEnabled(web_contents));
386 // If the action *does* want to run on the active web contents and is also 386 // If the action *does* want to run on the active web contents and is also
387 // overflowed, we add a decoration so that the user can see which overflowed 387 // overflowed, we add a decoration so that the user can see which overflowed
388 // action wants to run (since they wouldn't be able to see the change from 388 // action wants to run (since they wouldn't be able to see the change from
389 // grayscale to color). 389 // grayscale to color).
390 bool is_overflow = 390 bool is_overflow =
391 toolbar_actions_bar_ && toolbar_actions_bar_->in_overflow_mode(); 391 toolbar_actions_bar_ && toolbar_actions_bar_->in_overflow_mode();
392 image_source->set_paint_decoration(WantsToRun(web_contents) && is_overflow); 392 image_source->set_paint_decoration(WantsToRun(web_contents) && is_overflow);
393 } 393 }
394 394
395 return image_source.Pass(); 395 return image_source;
396 } 396 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/crypto_module_delegate_nss.cc ('k') | chrome/browser/ui/extensions/extension_installed_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698