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

Side by Side Diff: chrome/browser/ui/gtk/download/download_started_animation_gtk.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "content/browser/tab_contents/tab_contents.h" 10 #include "content/browser/tab_contents/tab_contents.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 height_ = gdk_pixbuf_get_height(kDownloadImage); 91 height_ = gdk_pixbuf_get_height(kDownloadImage);
92 92
93 // If we're too small to show the download image, then don't bother - 93 // If we're too small to show the download image, then don't bother -
94 // the shelf will be enough. 94 // the shelf will be enough.
95 tab_contents_->GetContainerBounds(&tab_contents_bounds_); 95 tab_contents_->GetContainerBounds(&tab_contents_bounds_);
96 if (tab_contents_bounds_.height() < height_) 96 if (tab_contents_bounds_.height() < height_)
97 return; 97 return;
98 98
99 registrar_.Add( 99 registrar_.Add(
100 this, 100 this,
101 NotificationType::TAB_CONTENTS_HIDDEN, 101 chrome::TAB_CONTENTS_HIDDEN,
102 Source<TabContents>(tab_contents_)); 102 Source<TabContents>(tab_contents_));
103 registrar_.Add( 103 registrar_.Add(
104 this, 104 this,
105 NotificationType::TAB_CONTENTS_DESTROYED, 105 chrome::TAB_CONTENTS_DESTROYED,
106 Source<TabContents>(tab_contents_)); 106 Source<TabContents>(tab_contents_));
107 107
108 // TODO(estade): don't show up on the wrong virtual desktop. 108 // TODO(estade): don't show up on the wrong virtual desktop.
109 109
110 popup_ = gtk_window_new(GTK_WINDOW_POPUP); 110 popup_ = gtk_window_new(GTK_WINDOW_POPUP);
111 GtkWidget* image = gtk_image_new_from_pixbuf(kDownloadImage); 111 GtkWidget* image = gtk_image_new_from_pixbuf(kDownloadImage);
112 gtk_container_add(GTK_CONTAINER(popup_), image); 112 gtk_container_add(GTK_CONTAINER(popup_), image);
113 113
114 // Set the shape of the window to that of the arrow. Areas with 114 // Set the shape of the window to that of the arrow. Areas with
115 // opacity less than 0xff (i.e. <100% opacity) will be transparent. 115 // opacity less than 0xff (i.e. <100% opacity) will be transparent.
(...skipping 27 matching lines...) Expand all
143 static_cast<int>(tab_contents_bounds_.bottom() - 143 static_cast<int>(tab_contents_bounds_.bottom() -
144 height_ - height_ * (1 - GetCurrentValue()))); 144 height_ - height_ * (1 - GetCurrentValue())));
145 } 145 }
146 146
147 void DownloadStartedAnimationGtk::Close() { 147 void DownloadStartedAnimationGtk::Close() {
148 if (!tab_contents_) 148 if (!tab_contents_)
149 return; 149 return;
150 150
151 registrar_.Remove( 151 registrar_.Remove(
152 this, 152 this,
153 NotificationType::TAB_CONTENTS_HIDDEN, 153 chrome::TAB_CONTENTS_HIDDEN,
154 Source<TabContents>(tab_contents_)); 154 Source<TabContents>(tab_contents_));
155 registrar_.Remove( 155 registrar_.Remove(
156 this, 156 this,
157 NotificationType::TAB_CONTENTS_DESTROYED, 157 chrome::TAB_CONTENTS_DESTROYED,
158 Source<TabContents>(tab_contents_)); 158 Source<TabContents>(tab_contents_));
159 159
160 tab_contents_ = NULL; 160 tab_contents_ = NULL;
161 gtk_widget_destroy(popup_); 161 gtk_widget_destroy(popup_);
162 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 162 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
163 } 163 }
164 164
165 void DownloadStartedAnimationGtk::AnimateToState(double state) { 165 void DownloadStartedAnimationGtk::AnimateToState(double state) {
166 if (!tab_contents_) 166 if (!tab_contents_)
167 return; 167 return;
(...skipping 18 matching lines...) Expand all
186 Close(); 186 Close();
187 } 187 }
188 188
189 } // namespace 189 } // namespace
190 190
191 // static 191 // static
192 void DownloadStartedAnimation::Show(TabContents* tab_contents) { 192 void DownloadStartedAnimation::Show(TabContents* tab_contents) {
193 // The animation will delete itself. 193 // The animation will delete itself.
194 new DownloadStartedAnimationGtk(tab_contents); 194 new DownloadStartedAnimationGtk(tab_contents);
195 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698