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

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

Issue 10533046: TabContentsWrapper -> TabContents, part 4. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compiling is good Created 8 years, 6 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 | Annotate | Revision Log
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/utf_string_conversions.h" 7 #include "base/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"
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents.h"
12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" 12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "third_party/skia/include/core/SkShader.h" 15 #include "third_party/skia/include/core/SkShader.h"
16 #include "ui/base/animation/slide_animation.h" 16 #include "ui/base/animation/slide_animation.h"
17 #include "ui/base/animation/tween.h" 17 #include "ui/base/animation/tween.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
21 #include "ui/gfx/skia_util.h" 21 #include "ui/gfx/skia_util.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 SetVisible(false); 73 SetVisible(false);
74 return; 74 return;
75 } 75 }
76 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 76 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
77 content_setting_image_model_->get_icon())); 77 content_setting_image_model_->get_icon()));
78 SetTooltipText(UTF8ToUTF16(content_setting_image_model_->get_tooltip())); 78 SetTooltipText(UTF8ToUTF16(content_setting_image_model_->get_tooltip()));
79 SetVisible(true); 79 SetVisible(true);
80 80
81 TabSpecificContentSettings* content_settings = NULL; 81 TabSpecificContentSettings* content_settings = NULL;
82 if (web_contents) { 82 if (web_contents) {
83 content_settings = TabContentsWrapper::GetCurrentWrapperForContents( 83 content_settings = TabContents::GetOwningTabContentsForWebContents(
84 web_contents)->content_settings(); 84 web_contents)->content_settings();
85 } 85 }
86 if (!content_settings || content_settings->IsBlockageIndicated( 86 if (!content_settings || content_settings->IsBlockageIndicated(
87 content_setting_image_model_->get_content_settings_type())) 87 content_setting_image_model_->get_content_settings_type()))
88 return; 88 return;
89 89
90 // The content blockage was not yet indicated to the user. Start indication 90 // The content blockage was not yet indicated to the user. Start indication
91 // animation and clear "not yet shown" flag. 91 // animation and clear "not yet shown" flag.
92 content_settings->SetBlockageHasBeenIndicated( 92 content_settings->SetBlockageHasBeenIndicated(
93 content_setting_image_model_->get_content_settings_type()); 93 content_setting_image_model_->get_content_settings_type());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 bool ContentSettingImageView::OnMousePressed(const views::MouseEvent& event) { 159 bool ContentSettingImageView::OnMousePressed(const views::MouseEvent& event) {
160 // We want to show the bubble on mouse release; that is the standard behavior 160 // We want to show the bubble on mouse release; that is the standard behavior
161 // for buttons. 161 // for buttons.
162 return true; 162 return true;
163 } 163 }
164 164
165 void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { 165 void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) {
166 if (!HitTest(event.location())) 166 if (!HitTest(event.location()))
167 return; 167 return;
168 168
169 TabContentsWrapper* tab_contents = parent_->GetTabContentsWrapper(); 169 TabContents* tab_contents = parent_->GetTabContents();
170 if (!tab_contents) 170 if (!tab_contents)
171 return; 171 return;
172 172
173 // Stop animation. 173 // Stop animation.
174 if (slide_animator_.get() && slide_animator_->is_animating()) { 174 if (slide_animator_.get() && slide_animator_->is_animating()) {
175 slide_animator_->Reset(); 175 slide_animator_->Reset();
176 pause_animation_ = true; 176 pause_animation_ = true;
177 } 177 }
178 178
179 Profile* profile = parent_->profile(); 179 Profile* profile = parent_->profile();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bubble_widget_->RemoveObserver(this); 256 bubble_widget_->RemoveObserver(this);
257 bubble_widget_ = NULL; 257 bubble_widget_ = NULL;
258 } 258 }
259 if (pause_animation_) { 259 if (pause_animation_) {
260 slide_animator_->Reset( 260 slide_animator_->Reset(
261 1.0 - (visible_text_size_ * kAnimatingFraction) / text_size_); 261 1.0 - (visible_text_size_ * kAnimatingFraction) / text_size_);
262 pause_animation_ = false; 262 pause_animation_ = false;
263 slide_animator_->Show(); 263 slide_animator_->Show();
264 } 264 }
265 } 265 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/click_handler.cc ('k') | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698