| 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 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "chrome/app/vector_icons/vector_icons.h" | 21 #include "chrome/app/vector_icons/vector_icons.h" |
| 22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" | 23 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" |
| 24 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" | 24 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_dialogs.h" |
| 27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 28 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 28 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 29 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 29 #include "chrome/browser/ui/views/harmony/chrome_typography.h" | 30 #include "chrome/browser/ui/views/harmony/chrome_typography.h" |
| 30 #include "chrome/common/extensions/extension_constants.h" | 31 #include "chrome/common/extensions/extension_constants.h" |
| 31 #include "chrome/grit/generated_resources.h" | 32 #include "chrome/grit/generated_resources.h" |
| 32 #include "components/constrained_window/constrained_window_views.h" | 33 #include "components/constrained_window/constrained_window_views.h" |
| 33 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/page_navigator.h" | 35 #include "content/public/browser/page_navigator.h" |
| 35 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
| 36 #include "extensions/common/extension.h" | 37 #include "extensions/common/extension.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt) | 182 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt) |
| 182 : profile_(profile), | 183 : profile_(profile), |
| 183 navigator_(navigator), | 184 navigator_(navigator), |
| 184 done_callback_(done_callback), | 185 done_callback_(done_callback), |
| 185 prompt_(std::move(prompt)), | 186 prompt_(std::move(prompt)), |
| 186 container_(NULL), | 187 container_(NULL), |
| 187 scroll_view_(NULL), | 188 scroll_view_(NULL), |
| 188 handled_result_(false), | 189 handled_result_(false), |
| 189 install_button_enabled_(false) { | 190 install_button_enabled_(false) { |
| 190 InitView(); | 191 InitView(); |
| 192 chrome::RecordDialogCreation(chrome::DialogIdentifier::EXTENSION_INSTALL); |
| 191 } | 193 } |
| 192 | 194 |
| 193 ExtensionInstallDialogView::~ExtensionInstallDialogView() { | 195 ExtensionInstallDialogView::~ExtensionInstallDialogView() { |
| 194 if (!handled_result_ && !done_callback_.is_null()) { | 196 if (!handled_result_ && !done_callback_.is_null()) { |
| 195 base::ResetAndReturn(&done_callback_) | 197 base::ResetAndReturn(&done_callback_) |
| 196 .Run(ExtensionInstallPrompt::Result::USER_CANCELED); | 198 .Run(ExtensionInstallPrompt::Result::USER_CANCELED); |
| 197 } | 199 } |
| 198 } | 200 } |
| 199 | 201 |
| 200 void ExtensionInstallDialogView::InitView() { | 202 void ExtensionInstallDialogView::InitView() { |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 gfx::ImageSkia icon = gfx::CreateVectorIcon( | 789 gfx::ImageSkia icon = gfx::CreateVectorIcon( |
| 788 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey); | 790 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey); |
| 789 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); | 791 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); |
| 790 } | 792 } |
| 791 | 793 |
| 792 // static | 794 // static |
| 793 ExtensionInstallPrompt::ShowDialogCallback | 795 ExtensionInstallPrompt::ShowDialogCallback |
| 794 ExtensionInstallPrompt::GetViewsShowDialogCallback() { | 796 ExtensionInstallPrompt::GetViewsShowDialogCallback() { |
| 795 return base::Bind(&ShowExtensionInstallDialogImpl); | 797 return base::Bind(&ShowExtensionInstallDialogImpl); |
| 796 } | 798 } |
| OLD | NEW |