| 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/extensions/extension_install_prompt.h" | 5 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 const { | 400 const { |
| 401 return l10n_util::GetPluralStringFUTF16( | 401 return l10n_util::GetPluralStringFUTF16( |
| 402 IDS_EXTENSION_PROMPT_RETAINED_DEVICES, GetRetainedDeviceCount()); | 402 IDS_EXTENSION_PROMPT_RETAINED_DEVICES, GetRetainedDeviceCount()); |
| 403 } | 403 } |
| 404 | 404 |
| 405 bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const { | 405 bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const { |
| 406 return GetPermissionCount(ALL_PERMISSIONS) > 0 || | 406 return GetPermissionCount(ALL_PERMISSIONS) > 0 || |
| 407 type_ == POST_INSTALL_PERMISSIONS_PROMPT; | 407 type_ == POST_INSTALL_PERMISSIONS_PROMPT; |
| 408 } | 408 } |
| 409 | 409 |
| 410 bool ExtensionInstallPrompt::Prompt::ShouldUseTabModalDialog() const { |
| 411 // For inline install, we want the install prompt to be tab modal so that the |
| 412 // dialog is always clearly associated with the page that made the inline |
| 413 // install request. |
| 414 return type_ == INLINE_INSTALL_PROMPT; |
| 415 } |
| 416 |
| 410 void ExtensionInstallPrompt::Prompt::AppendRatingStars( | 417 void ExtensionInstallPrompt::Prompt::AppendRatingStars( |
| 411 StarAppender appender, void* data) const { | 418 StarAppender appender, void* data) const { |
| 412 CHECK(appender); | 419 CHECK(appender); |
| 413 CHECK(AllowWebstoreData(type_)); | 420 CHECK(AllowWebstoreData(type_)); |
| 414 int rating_integer = floor(average_rating_); | 421 int rating_integer = floor(average_rating_); |
| 415 double rating_fractional = average_rating_ - rating_integer; | 422 double rating_fractional = average_rating_ - rating_integer; |
| 416 | 423 |
| 417 if (rating_fractional > 0.66) { | 424 if (rating_fractional > 0.66) { |
| 418 rating_integer++; | 425 rating_integer++; |
| 419 } | 426 } |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 if (show_params_->WasParentDestroyed()) { | 935 if (show_params_->WasParentDestroyed()) { |
| 929 delegate_->InstallUIAbort(false); | 936 delegate_->InstallUIAbort(false); |
| 930 return; | 937 return; |
| 931 } | 938 } |
| 932 | 939 |
| 933 if (show_dialog_callback_.is_null()) | 940 if (show_dialog_callback_.is_null()) |
| 934 GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_); | 941 GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_); |
| 935 else | 942 else |
| 936 show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_); | 943 show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_); |
| 937 } | 944 } |
| OLD | NEW |