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

Side by Side Diff: chrome/browser/ui/gtk/download/download_item_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/ui/gtk/download/download_item_gtk.h" 5 #include "chrome/browser/ui/gtk/download/download_item_gtk.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 gtk_container_add(GTK_CONTAINER(dangerous_prompt_), dangerous_hbox_.get()); 235 gtk_container_add(GTK_CONTAINER(dangerous_prompt_), dangerous_hbox_.get());
236 gtk_box_pack_start(GTK_BOX(hbox_.get()), dangerous_prompt_, FALSE, FALSE, 236 gtk_box_pack_start(GTK_BOX(hbox_.get()), dangerous_prompt_, FALSE, FALSE,
237 0); 237 0);
238 gtk_widget_set_app_paintable(dangerous_prompt_, TRUE); 238 gtk_widget_set_app_paintable(dangerous_prompt_, TRUE);
239 gtk_widget_set_redraw_on_allocate(dangerous_prompt_, TRUE); 239 gtk_widget_set_redraw_on_allocate(dangerous_prompt_, TRUE);
240 g_signal_connect(dangerous_prompt_, "expose-event", 240 g_signal_connect(dangerous_prompt_, "expose-event",
241 G_CALLBACK(OnDangerousPromptExposeThunk), this); 241 G_CALLBACK(OnDangerousPromptExposeThunk), this);
242 gtk_widget_show_all(dangerous_prompt_); 242 gtk_widget_show_all(dangerous_prompt_);
243 } 243 }
244 244
245 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, 245 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
246 Source<ThemeService>(theme_service_)); 246 Source<ThemeService>(theme_service_));
247 theme_service_->InitThemesFor(this); 247 theme_service_->InitThemesFor(this);
248 248
249 // Set the initial width of the widget to be animated. 249 // Set the initial width of the widget to be animated.
250 if (IsDangerous()) { 250 if (IsDangerous()) {
251 gtk_widget_set_size_request(dangerous_hbox_.get(), 251 gtk_widget_set_size_request(dangerous_hbox_.get(),
252 dangerous_hbox_start_width_, -1); 252 dangerous_hbox_start_width_, -1);
253 } else { 253 } else {
254 gtk_widget_set_size_request(body_.get(), kMinDownloadItemWidth, -1); 254 gtk_widget_set_size_request(body_.get(), kMinDownloadItemWidth, -1);
255 } 255 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 int showing_width = dangerous_hbox_start_width_ + progress; 360 int showing_width = dangerous_hbox_start_width_ + progress;
361 gtk_widget_set_size_request(dangerous_hbox_.get(), showing_width, -1); 361 gtk_widget_set_size_request(dangerous_hbox_.get(), showing_width, -1);
362 } else { 362 } else {
363 int showing_width = std::max(kMinDownloadItemWidth, 363 int showing_width = std::max(kMinDownloadItemWidth,
364 static_cast<int>(kBodyWidth * animation->GetCurrentValue())); 364 static_cast<int>(kBodyWidth * animation->GetCurrentValue()));
365 gtk_widget_set_size_request(body_.get(), showing_width, -1); 365 gtk_widget_set_size_request(body_.get(), showing_width, -1);
366 } 366 }
367 } 367 }
368 } 368 }
369 369
370 void DownloadItemGtk::Observe(NotificationType type, 370 void DownloadItemGtk::Observe(int type,
371 const NotificationSource& source, 371 const NotificationSource& source,
372 const NotificationDetails& details) { 372 const NotificationDetails& details) {
373 if (type == NotificationType::BROWSER_THEME_CHANGED) { 373 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) {
374 // Our GtkArrow is only visible in gtk mode. Otherwise, we let the custom 374 // Our GtkArrow is only visible in gtk mode. Otherwise, we let the custom
375 // rendering code do whatever it wants. 375 // rendering code do whatever it wants.
376 if (theme_service_->UsingNativeTheme()) { 376 if (theme_service_->UsingNativeTheme()) {
377 if (!arrow_) { 377 if (!arrow_) {
378 arrow_ = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); 378 arrow_ = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
379 gtk_widget_set_size_request(arrow_, 379 gtk_widget_set_size_request(arrow_,
380 static_cast<int>(kTextSize), 380 static_cast<int>(kTextSize),
381 static_cast<int>(kTextSize)); 381 static_cast<int>(kTextSize));
382 gtk_container_add(GTK_CONTAINER(menu_button_), arrow_); 382 gtk_container_add(GTK_CONTAINER(menu_button_), arrow_);
383 } 383 }
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 get_download()->DangerousDownloadValidated(); 863 get_download()->DangerousDownloadValidated();
864 } 864 }
865 865
866 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { 866 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) {
867 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", 867 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download",
868 base::Time::Now() - creation_time_); 868 base::Time::Now() - creation_time_);
869 if (get_download()->IsPartialDownload()) 869 if (get_download()->IsPartialDownload())
870 get_download()->Cancel(true); 870 get_download()->Cancel(true);
871 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); 871 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
872 } 872 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698