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

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

Issue 9479008: Re-factor location bar/toolbar code to get rid of the browser dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: call right overloaded method Created 8 years, 9 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/browser.h"
10 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
11 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
13 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" 12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
15 #include "chrome/browser/ui/views/window.h" 14 #include "chrome/browser/ui/views/window.h"
16 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
17 #include "third_party/skia/include/core/SkShader.h" 16 #include "third_party/skia/include/core/SkShader.h"
18 #include "ui/base/animation/slide_animation.h" 17 #include "ui/base/animation/slide_animation.h"
19 #include "ui/base/animation/tween.h" 18 #include "ui/base/animation/tween.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 TabContentsWrapper* tab_contents = parent_->GetTabContentsWrapper(); 170 TabContentsWrapper* tab_contents = parent_->GetTabContentsWrapper();
172 if (!tab_contents) 171 if (!tab_contents)
173 return; 172 return;
174 173
175 // Stop animation. 174 // Stop animation.
176 if (slide_animator_.get() && slide_animator_->is_animating()) { 175 if (slide_animator_.get() && slide_animator_->is_animating()) {
177 slide_animator_->Reset(); 176 slide_animator_->Reset();
178 pause_animation_ = true; 177 pause_animation_ = true;
179 } 178 }
180 179
181 Profile* profile = parent_->browser()->profile(); 180 Profile* profile = parent_->profile();
182 ContentSettingBubbleContents* bubble = new ContentSettingBubbleContents( 181 ContentSettingBubbleContents* bubble = new ContentSettingBubbleContents(
183 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 182 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
184 parent_->browser(), 183 parent_->delegate()->GetContentSettingBubbleModelDelegate(),
185 tab_contents, 184 tab_contents,
186 profile, 185 profile,
187 content_setting_image_model_->get_content_settings_type()), 186 content_setting_image_model_->get_content_settings_type()),
188 profile, 187 profile,
189 tab_contents->web_contents(), 188 tab_contents->web_contents(),
190 this, 189 this,
191 views::BubbleBorder::TOP_RIGHT); 190 views::BubbleBorder::TOP_RIGHT);
192 bubble_widget_ = browser::CreateViewsBubble(bubble); 191 bubble_widget_ = parent_->delegate()->CreateViewsBubble(bubble);
193 bubble_widget_->AddObserver(this); 192 bubble_widget_->AddObserver(this);
194 bubble->Show(); 193 bubble->Show();
195 } 194 }
196 195
197 void ContentSettingImageView::OnPaint(gfx::Canvas* canvas) { 196 void ContentSettingImageView::OnPaint(gfx::Canvas* canvas) {
198 // During the animation we draw a border, an icon and the text. The text area 197 // During the animation we draw a border, an icon and the text. The text area
199 // is changing in size during the animation, giving the appearance of the text 198 // is changing in size during the animation, giving the appearance of the text
200 // sliding out and then back in. When the text completely slid out the yellow 199 // sliding out and then back in. When the text completely slid out the yellow
201 // border is no longer painted around the icon. |visible_text_size_| is 0 when 200 // border is no longer painted around the icon. |visible_text_size_| is 0 when
202 // animation is stopped. 201 // animation is stopped.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 bubble_widget_->RemoveObserver(this); 257 bubble_widget_->RemoveObserver(this);
259 bubble_widget_ = NULL; 258 bubble_widget_ = NULL;
260 } 259 }
261 if (pause_animation_) { 260 if (pause_animation_) {
262 slide_animator_->Reset( 261 slide_animator_->Reset(
263 1.0 - (visible_text_size_ * kAnimatingFraction) / text_size_); 262 1.0 - (visible_text_size_ * kAnimatingFraction) / text_size_);
264 pause_animation_ = false; 263 pause_animation_ = false;
265 slide_animator_->Show(); 264 slide_animator_->Show();
266 } 265 }
267 } 266 }
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