| 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 string16 ExtensionInstallPrompt::Prompt::GetAbortButtonLabel() const { | 157 string16 ExtensionInstallPrompt::Prompt::GetAbortButtonLabel() const { |
| 158 CHECK(HasAbortButtonLabel()); | 158 CHECK(HasAbortButtonLabel()); |
| 159 return l10n_util::GetStringUTF16(kAbortButtonIds[type_]); | 159 return l10n_util::GetStringUTF16(kAbortButtonIds[type_]); |
| 160 } | 160 } |
| 161 | 161 |
| 162 string16 ExtensionInstallPrompt::Prompt::GetPermissionsHeading() const { | 162 string16 ExtensionInstallPrompt::Prompt::GetPermissionsHeading() const { |
| 163 return l10n_util::GetStringUTF16(kPermissionsHeaderIds[type_]); | 163 return l10n_util::GetStringUTF16(kPermissionsHeaderIds[type_]); |
| 164 } | 164 } |
| 165 | 165 |
| 166 string16 ExtensionInstallPrompt::Prompt::GetOAuthHeading() const { |
| 167 // TODO(estade): this should change based on type_. |
| 168 return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_SCOPES_HEADING); |
| 169 } |
| 170 |
| 166 void ExtensionInstallPrompt::Prompt::AppendRatingStars( | 171 void ExtensionInstallPrompt::Prompt::AppendRatingStars( |
| 167 StarAppender appender, void* data) const { | 172 StarAppender appender, void* data) const { |
| 168 CHECK(appender); | 173 CHECK(appender); |
| 169 CHECK_EQ(INLINE_INSTALL_PROMPT, type_); | 174 CHECK_EQ(INLINE_INSTALL_PROMPT, type_); |
| 170 int rating_integer = floor(average_rating_); | 175 int rating_integer = floor(average_rating_); |
| 171 double rating_fractional = average_rating_ - rating_integer; | 176 double rating_fractional = average_rating_ - rating_integer; |
| 172 | 177 |
| 173 if (rating_fractional > 0.66) { | 178 if (rating_fractional > 0.66) { |
| 174 rating_integer++; | 179 rating_integer++; |
| 175 } | 180 } |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 NOTREACHED() << "Unknown message"; | 471 NOTREACHED() << "Unknown message"; |
| 467 break; | 472 break; |
| 468 } | 473 } |
| 469 } | 474 } |
| 470 | 475 |
| 471 // static | 476 // static |
| 472 bool ExtensionInstallPrompt::ShouldAutomaticallyApproveScopes() { | 477 bool ExtensionInstallPrompt::ShouldAutomaticallyApproveScopes() { |
| 473 return !CommandLine::ForCurrentProcess()->HasSwitch( | 478 return !CommandLine::ForCurrentProcess()->HasSwitch( |
| 474 switches::kDemandUserScopeApproval); | 479 switches::kDemandUserScopeApproval); |
| 475 } | 480 } |
| OLD | NEW |