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

Side by Side Diff: chrome/browser/ui/views/download/download_started_animation_views.cc

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/download/download_started_animation.h" 5 #include "chrome/browser/download/download_started_animation.h"
6 6
7 #include "content/public/browser/notification_details.h" 7 #include "content/public/browser/notification_details.h"
8 #include "content/public/browser/notification_observer.h" 8 #include "content/public/browser/notification_observer.h"
9 #include "content/public/browser/notification_registrar.h" 9 #include "content/public/browser/notification_registrar.h"
10 #include "content/public/browser/notification_source.h" 10 #include "content/public/browser/notification_source.h"
11 #include "content/public/browser/notification_types.h" 11 #include "content/public/browser/notification_types.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_contents_view.h"
13 #include "grit/theme_resources.h" 14 #include "grit/theme_resources.h"
14 #include "ui/base/animation/linear_animation.h" 15 #include "ui/base/animation/linear_animation.h"
15 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
17 #include "ui/views/controls/image_view.h" 18 #include "ui/views/controls/image_view.h"
18 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
19 20
20 using content::WebContents; 21 using content::WebContents;
21 22
22 // How long to spend moving downwards and fading out after waiting. 23 // How long to spend moving downwards and fading out after waiting.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 popup_(NULL), 84 popup_(NULL),
84 web_contents_(web_contents) { 85 web_contents_(web_contents) {
85 static gfx::ImageSkia* kDownloadImage = NULL; 86 static gfx::ImageSkia* kDownloadImage = NULL;
86 if (!kDownloadImage) { 87 if (!kDownloadImage) {
87 kDownloadImage = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 88 kDownloadImage = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
88 IDR_DOWNLOAD_ANIMATION_BEGIN); 89 IDR_DOWNLOAD_ANIMATION_BEGIN);
89 } 90 }
90 91
91 // If we're too small to show the download image, then don't bother - 92 // If we're too small to show the download image, then don't bother -
92 // the shelf will be enough. 93 // the shelf will be enough.
93 web_contents_->GetContainerBounds(&web_contents_bounds_); 94 web_contents_->GetView()->GetContainerBounds(&web_contents_bounds_);
94 if (web_contents_bounds_.height() < kDownloadImage->height()) 95 if (web_contents_bounds_.height() < kDownloadImage->height())
95 return; 96 return;
96 97
97 registrar_.Add( 98 registrar_.Add(
98 this, 99 this,
99 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, 100 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
100 content::Source<WebContents>(web_contents_)); 101 content::Source<WebContents>(web_contents_));
101 registrar_.Add( 102 registrar_.Add(
102 this, 103 this,
103 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 104 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
104 content::Source<WebContents>(web_contents_)); 105 content::Source<WebContents>(web_contents_));
105 106
106 SetImage(kDownloadImage); 107 SetImage(kDownloadImage);
107 108
108 popup_ = new views::Widget; 109 popup_ = new views::Widget;
109 110
110 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 111 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
111 params.transparent = true; 112 params.transparent = true;
112 params.accept_events = false; 113 params.accept_events = false;
113 params.parent = web_contents_->GetNativeView(); 114 params.parent = web_contents_->GetView()->GetNativeView();
114 popup_->Init(params); 115 popup_->Init(params);
115 popup_->SetOpacity(0x00); 116 popup_->SetOpacity(0x00);
116 popup_->SetContentsView(this); 117 popup_->SetContentsView(this);
117 Reposition(); 118 Reposition();
118 popup_->Show(); 119 popup_->Show();
119 120
120 Start(); 121 Start();
121 } 122 }
122 123
123 void DownloadStartedAnimationWin::Reposition() { 124 void DownloadStartedAnimationWin::Reposition() {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 181 }
181 182
182 } // namespace 183 } // namespace
183 184
184 // static 185 // static
185 void DownloadStartedAnimation::Show(WebContents* web_contents) { 186 void DownloadStartedAnimation::Show(WebContents* web_contents) {
186 // The animation will delete itself when it's finished or when the tab 187 // The animation will delete itself when it's finished or when the tab
187 // contents is hidden or destroyed. 188 // contents is hidden or destroyed.
188 new DownloadStartedAnimationWin(web_contents); 189 new DownloadStartedAnimationWin(web_contents);
189 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/constrained_window_views.cc ('k') | chrome/browser/ui/views/dropdown_bar_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698