Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: chrome/browser/ui/views/location_bar/content_setting_image_view.cc

Issue 23557004: Save password bubble pops up automatically (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor change Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/location_bar/content_setting_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 slide_animator_.SetSlideDuration(kAnimationDurationMS); 88 slide_animator_.SetSlideDuration(kAnimationDurationMS);
89 slide_animator_.SetTweenType(ui::Tween::LINEAR); 89 slide_animator_.SetTweenType(ui::Tween::LINEAR);
90 } 90 }
91 91
92 ContentSettingImageView::~ContentSettingImageView() { 92 ContentSettingImageView::~ContentSettingImageView() {
93 if (bubble_widget_) 93 if (bubble_widget_)
94 bubble_widget_->RemoveObserver(this); 94 bubble_widget_->RemoveObserver(this);
95 } 95 }
96 96
97 void ContentSettingImageView::Update(content::WebContents* web_contents) { 97 void ContentSettingImageView::UpdatePreLayout(
98 content::WebContents* web_contents) {
98 // Note: We explicitly want to call this even if |web_contents| is NULL, so we 99 // Note: We explicitly want to call this even if |web_contents| is NULL, so we
99 // get hidden properly while the user is editing the omnibox. 100 // get hidden properly while the user is editing the omnibox.
100 content_setting_image_model_->UpdateFromWebContents(web_contents); 101 content_setting_image_model_->UpdateFromWebContents(web_contents);
101 102
102 if (!content_setting_image_model_->is_visible()) { 103 if (!content_setting_image_model_->is_visible()) {
103 SetVisible(false); 104 SetVisible(false);
104 return; 105 return;
105 } 106 }
106 107
107 icon_->SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 108 icon_->SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
(...skipping 12 matching lines...) Expand all
120 121
121 // We just ignore this blockage if we're already showing some other string to 122 // We just ignore this blockage if we're already showing some other string to
122 // the user. If this becomes a problem, we could design some sort of queueing 123 // the user. If this becomes a problem, we could design some sort of queueing
123 // mechanism to show one after the other, but it doesn't seem important now. 124 // mechanism to show one after the other, but it doesn't seem important now.
124 int string_id = content_setting_image_model_->explanatory_string_id(); 125 int string_id = content_setting_image_model_->explanatory_string_id();
125 if (string_id && !background_showing()) { 126 if (string_id && !background_showing()) {
126 text_label_->SetText(l10n_util::GetStringUTF16(string_id)); 127 text_label_->SetText(l10n_util::GetStringUTF16(string_id));
127 text_label_->SetVisible(true); 128 text_label_->SetVisible(true);
128 slide_animator_.Show(); 129 slide_animator_.Show();
129 } 130 }
131 }
Peter Kasting 2013/09/05 06:55:19 Nit: Add comment at end of function: Since indica
npentrel 2013/09/05 08:28:09 Done.
130 132
131 content_settings->SetBlockageHasBeenIndicated( 133 void ContentSettingImageView::UpdatePostLayout(
132 content_setting_image_model_->get_content_settings_type()); 134 content::WebContents* web_contents) {
135 if (!content_setting_image_model_->is_visible())
136 return;
137
138 TabSpecificContentSettings* content_settings = web_contents ?
139 TabSpecificContentSettings::FromWebContents(web_contents) : NULL;
140 if (!content_settings)
141 return;
142 if (!content_settings->IsBlockageIndicated(
Peter Kasting 2013/09/05 06:55:19 Nit: Either put a blank line here, or remove the o
npentrel 2013/09/05 08:28:09 Done.
143 content_setting_image_model_->get_content_settings_type())) {
144 if (content_setting_image_model_->ShouldShowBubbleOnBlockage()) {
Peter Kasting 2013/09/05 06:55:19 Nit: No {}
npentrel 2013/09/05 08:28:09 Done.
145 CreateBubble(web_contents);
146 }
147 content_settings->SetBlockageHasBeenIndicated(
148 content_setting_image_model_->get_content_settings_type());
149 }
133 } 150 }
134 151
135 // static 152 // static
136 int ContentSettingImageView::GetBubbleOuterPadding(bool by_icon) { 153 int ContentSettingImageView::GetBubbleOuterPadding(bool by_icon) {
137 return LocationBarView::GetItemPadding() - LocationBarView::kBubblePadding + 154 return LocationBarView::GetItemPadding() - LocationBarView::kBubblePadding +
138 (by_icon ? 0 : LocationBarView::kIconInternalPadding); 155 (by_icon ? 0 : LocationBarView::kIconInternalPadding);
139 } 156 }
140 157
141 void ContentSettingImageView::AnimationEnded(const ui::Animation* animation) { 158 void ContentSettingImageView::AnimationEnded(const ui::Animation* animation) {
142 slide_animator_.Reset(); 159 slide_animator_.Reset();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (slide_animator_.is_animating()) { 256 if (slide_animator_.is_animating()) {
240 if (!pause_animation_) { 257 if (!pause_animation_) {
241 pause_animation_ = true; 258 pause_animation_ = true;
242 pause_animation_state_ = slide_animator_.GetCurrentValue(); 259 pause_animation_state_ = slide_animator_.GetCurrentValue();
243 } 260 }
244 slide_animator_.Reset(); 261 slide_animator_.Reset();
245 } 262 }
246 263
247 content::WebContents* web_contents = parent_->GetWebContents(); 264 content::WebContents* web_contents = parent_->GetWebContents();
248 if (web_contents && !bubble_widget_) { 265 if (web_contents && !bubble_widget_) {
249 bubble_widget_ = 266 CreateBubble(web_contents);
250 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents(
251 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
252 parent_->delegate()->GetContentSettingBubbleModelDelegate(),
253 web_contents, parent_->profile(),
254 content_setting_image_model_->get_content_settings_type()),
255 web_contents, this, views::BubbleBorder::TOP_RIGHT));
256 bubble_widget_->AddObserver(this);
257 bubble_widget_->Show();
258 } 267 }
259 } 268 }
269
270 void ContentSettingImageView::CreateBubble(content::WebContents* web_contents) {
271 bubble_widget_ =
272 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents(
273 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
274 parent_->delegate()->GetContentSettingBubbleModelDelegate(),
275 web_contents, parent_->profile(),
276 content_setting_image_model_->get_content_settings_type()),
277 web_contents, this, views::BubbleBorder::TOP_RIGHT));
278 bubble_widget_->AddObserver(this);
279 bubble_widget_->Show();
280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698