OLD | NEW |
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 #import "chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.
h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.
h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" | 14 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" |
15 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" | 15 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_dialogs.h" | 17 #include "chrome/browser/ui/browser_dialogs.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
19 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 19 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
20 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_w
indow.h" | 20 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_w
indow.h" |
21 #import "chrome/browser/ui/cocoa/extensions/windowed_install_dialog_controller.h
" | 21 #import "chrome/browser/ui/cocoa/extensions/windowed_install_dialog_controller.h
" |
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 OnPromptButtonClicked(ExtensionInstallPrompt::Result::USER_CANCELED, | 91 OnPromptButtonClicked(ExtensionInstallPrompt::Result::USER_CANCELED, |
92 ExperienceSamplingEvent::kDeny); | 92 ExperienceSamplingEvent::kDeny); |
93 } | 93 } |
94 | 94 |
95 void ExtensionInstallDialogController::OnConstrainedWindowClosed( | 95 void ExtensionInstallDialogController::OnConstrainedWindowClosed( |
96 ConstrainedWindowMac* window) { | 96 ConstrainedWindowMac* window) { |
97 if (!done_callback_.is_null()) { | 97 if (!done_callback_.is_null()) { |
98 base::ResetAndReturn(&done_callback_).Run( | 98 base::ResetAndReturn(&done_callback_).Run( |
99 ExtensionInstallPrompt::Result::ABORTED); | 99 ExtensionInstallPrompt::Result::ABORTED); |
100 } | 100 } |
101 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 101 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
102 } | 102 } |
103 | 103 |
104 void ExtensionInstallDialogController::OnPromptButtonClicked( | 104 void ExtensionInstallDialogController::OnPromptButtonClicked( |
105 ExtensionInstallPrompt::Result result, | 105 ExtensionInstallPrompt::Result result, |
106 const char* decision_event) { | 106 const char* decision_event) { |
107 if (sampling_event_.get()) | 107 if (sampling_event_.get()) |
108 sampling_event_->CreateUserDecisionEvent(decision_event); | 108 sampling_event_->CreateUserDecisionEvent(decision_event); |
109 base::ResetAndReturn(&done_callback_).Run(result); | 109 base::ResetAndReturn(&done_callback_).Run(result); |
110 constrained_window_->CloseWebContentsModalDialog(); | 110 constrained_window_->CloseWebContentsModalDialog(); |
111 } | 111 } |
112 | 112 |
113 // static | 113 // static |
114 ExtensionInstallPrompt::ShowDialogCallback | 114 ExtensionInstallPrompt::ShowDialogCallback |
115 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { | 115 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { |
116 if (chrome::ToolkitViewsWebUIDialogsEnabled()) | 116 if (chrome::ToolkitViewsWebUIDialogsEnabled()) |
117 return ExtensionInstallPrompt::GetViewsShowDialogCallback(); | 117 return ExtensionInstallPrompt::GetViewsShowDialogCallback(); |
118 return base::Bind(&ShowExtensionInstallDialogImpl); | 118 return base::Bind(&ShowExtensionInstallDialogImpl); |
119 } | 119 } |
OLD | NEW |