OLD | NEW |
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/extension_action_runner.h" | 5 #include "chrome/browser/extensions/extension_action_runner.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 browser ? browser->window()->GetToolbarActionsBar() : nullptr; | 350 browser ? browser->window()->GetToolbarActionsBar() : nullptr; |
351 if (toolbar_actions_bar) { | 351 if (toolbar_actions_bar) { |
352 auto callback = | 352 auto callback = |
353 base::Bind(&ExtensionActionRunner::OnBlockedActionBubbleClosed, | 353 base::Bind(&ExtensionActionRunner::OnBlockedActionBubbleClosed, |
354 weak_factory_.GetWeakPtr(), extension->id()); | 354 weak_factory_.GetWeakPtr(), extension->id()); |
355 if (default_bubble_close_action_for_testing_) { | 355 if (default_bubble_close_action_for_testing_) { |
356 base::ThreadTaskRunnerHandle::Get()->PostTask( | 356 base::ThreadTaskRunnerHandle::Get()->PostTask( |
357 FROM_HERE, | 357 FROM_HERE, |
358 base::Bind(callback, *default_bubble_close_action_for_testing_)); | 358 base::Bind(callback, *default_bubble_close_action_for_testing_)); |
359 } else { | 359 } else { |
360 toolbar_actions_bar->ShowToolbarActionBubble(base::WrapUnique( | 360 toolbar_actions_bar->ShowToolbarActionBubble( |
361 new BlockedActionBubbleDelegate(callback, extension->id()))); | 361 base::MakeUnique<BlockedActionBubbleDelegate>(callback, |
| 362 extension->id())); |
362 } | 363 } |
363 } | 364 } |
364 } | 365 } |
365 | 366 |
366 void ExtensionActionRunner::OnBlockedActionBubbleClosed( | 367 void ExtensionActionRunner::OnBlockedActionBubbleClosed( |
367 const std::string& extension_id, | 368 const std::string& extension_id, |
368 ToolbarActionsBarBubbleDelegate::CloseAction action) { | 369 ToolbarActionsBarBubbleDelegate::CloseAction action) { |
369 // If the user agreed to refresh the page, do so. | 370 // If the user agreed to refresh the page, do so. |
370 if (action == ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE) { | 371 if (action == ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE) { |
371 const Extension* extension = ExtensionRegistry::Get(browser_context_) | 372 const Extension* extension = ExtensionRegistry::Get(browser_context_) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 UnloadedExtensionInfo::Reason reason) { | 420 UnloadedExtensionInfo::Reason reason) { |
420 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); | 421 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); |
421 if (iter != pending_scripts_.end()) { | 422 if (iter != pending_scripts_.end()) { |
422 pending_scripts_.erase(iter); | 423 pending_scripts_.erase(iter); |
423 ExtensionActionAPI::Get(browser_context_) | 424 ExtensionActionAPI::Get(browser_context_) |
424 ->NotifyPageActionsChanged(web_contents()); | 425 ->NotifyPageActionsChanged(web_contents()); |
425 } | 426 } |
426 } | 427 } |
427 | 428 |
428 } // namespace extensions | 429 } // namespace extensions |
OLD | NEW |