| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/location_bar/content_setting_image_view.h" | 5 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 // The content blockage was not yet indicated to the user. Start indication | 89 // The content blockage was not yet indicated to the user. Start indication |
| 90 // animation and clear "not yet shown" flag. | 90 // animation and clear "not yet shown" flag. |
| 91 content_settings->SetBlockageHasBeenIndicated( | 91 content_settings->SetBlockageHasBeenIndicated( |
| 92 content_setting_image_model_->get_content_settings_type()); | 92 content_setting_image_model_->get_content_settings_type()); |
| 93 | 93 |
| 94 int animated_string_id = | 94 int animated_string_id = |
| 95 content_setting_image_model_->explanatory_string_id(); | 95 content_setting_image_model_->explanatory_string_id(); |
| 96 // Check if the animation is enabled and if the string for animation is | 96 // Check if the animation is enabled and if the string for animation is |
| 97 // available. | 97 // available. |
| 98 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 98 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 99 switches::kEnableBlockContentAnimation) || !animated_string_id) | 99 switches::kDisableBlockContentAnimation) || !animated_string_id) |
| 100 return; | 100 return; |
| 101 | 101 |
| 102 // Do not start animation if already in progress. | 102 // Do not start animation if already in progress. |
| 103 if (!animation_in_progress_) { | 103 if (!animation_in_progress_) { |
| 104 animation_in_progress_ = true; | 104 animation_in_progress_ = true; |
| 105 // Initialize animated string. It will be cleared when animation is | 105 // Initialize animated string. It will be cleared when animation is |
| 106 // completed. | 106 // completed. |
| 107 animated_text_ = l10n_util::GetStringUTF16(animated_string_id); | 107 animated_text_ = l10n_util::GetStringUTF16(animated_string_id); |
| 108 text_size_ = ResourceBundle::GetSharedInstance().GetFont( | 108 text_size_ = ResourceBundle::GetSharedInstance().GetFont( |
| 109 ResourceBundle::MediumFont).GetStringWidth(animated_text_); | 109 ResourceBundle::MediumFont).GetStringWidth(animated_text_); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } else if (state > (1.0 - kAnimatingFraction)) { | 235 } else if (state > (1.0 - kAnimatingFraction)) { |
| 236 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / | 236 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / |
| 237 kAnimatingFraction); | 237 kAnimatingFraction); |
| 238 } else { | 238 } else { |
| 239 visible_text_size_ = text_size_; | 239 visible_text_size_ = text_size_; |
| 240 } | 240 } |
| 241 parent_->Layout(); | 241 parent_->Layout(); |
| 242 parent_->SchedulePaint(); | 242 parent_->SchedulePaint(); |
| 243 } | 243 } |
| 244 | 244 |
| OLD | NEW |