| OLD | NEW |
| 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/notifications/balloon_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/notifications/balloon_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
| 32 #include "content/browser/renderer_host/render_view_host.h" | 32 #include "content/browser/renderer_host/render_view_host.h" |
| 33 #include "content/browser/renderer_host/render_widget_host_view.h" | 33 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 34 #include "content/common/notification_details.h" | 34 #include "content/common/notification_details.h" |
| 35 #include "content/common/notification_service.h" | 35 #include "content/common/notification_service.h" |
| 36 #include "content/common/notification_source.h" | 36 #include "content/common/notification_source.h" |
| 37 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 38 #include "grit/theme_resources.h" | 38 #include "grit/theme_resources.h" |
| 39 #include "grit/theme_resources_standard.h" | 39 #include "grit/theme_resources_standard.h" |
| 40 #include "ui/base/animation/slide_animation.h" | 40 #include "ui/base/animation/slide_animation.h" |
| 41 #include "ui/base/gtk/gtk_hig_constants.h" | |
| 42 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
| 43 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
| 44 #include "ui/gfx/canvas.h" | 43 #include "ui/gfx/canvas.h" |
| 45 #include "ui/gfx/insets.h" | 44 #include "ui/gfx/insets.h" |
| 46 #include "ui/gfx/native_widget_types.h" | 45 #include "ui/gfx/native_widget_types.h" |
| 47 | 46 |
| 48 namespace { | 47 namespace { |
| 49 | 48 |
| 50 // Margin, in pixels, between the notification frame and the contents | 49 // Margin, in pixels, between the notification frame and the contents |
| 51 // of the notification. | 50 // of the notification. |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 kShelfVerticalMargin, kShelfVerticalMargin, | 310 kShelfVerticalMargin, kShelfVerticalMargin, |
| 312 0, kButtonSpacing); | 311 0, kButtonSpacing); |
| 313 gtk_container_add(GTK_CONTAINER(options_alignment), | 312 gtk_container_add(GTK_CONTAINER(options_alignment), |
| 314 options_menu_button_->widget()); | 313 options_menu_button_->widget()); |
| 315 gtk_box_pack_end(GTK_BOX(hbox_), options_alignment, FALSE, FALSE, 0); | 314 gtk_box_pack_end(GTK_BOX(hbox_), options_alignment, FALSE, FALSE, 0); |
| 316 | 315 |
| 317 notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 316 notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 318 Source<ThemeService>(theme_service_)); | 317 Source<ThemeService>(theme_service_)); |
| 319 | 318 |
| 320 // We don't do InitThemesFor() because it just forces a redraw. | 319 // We don't do InitThemesFor() because it just forces a redraw. |
| 321 gtk_util::ActAsRoundedWindow(frame_container_, ui::kGdkBlack, 3, | 320 gtk_util::ActAsRoundedWindow(frame_container_, gtk_util::kGdkBlack, 3, |
| 322 gtk_util::ROUNDED_ALL, | 321 gtk_util::ROUNDED_ALL, |
| 323 gtk_util::BORDER_ALL); | 322 gtk_util::BORDER_ALL); |
| 324 | 323 |
| 325 // Realize the frame container so we can do size calculations. | 324 // Realize the frame container so we can do size calculations. |
| 326 gtk_widget_realize(frame_container_); | 325 gtk_widget_realize(frame_container_); |
| 327 | 326 |
| 328 // Update to make sure we have everything sized properly and then move our | 327 // Update to make sure we have everything sized properly and then move our |
| 329 // window offscreen for its initial animation. | 328 // window offscreen for its initial animation. |
| 330 html_contents_->UpdateActualSize(balloon_->content_size()); | 329 html_contents_->UpdateActualSize(balloon_->content_size()); |
| 331 int window_width; | 330 int window_width; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 method_factory_.NewRunnableMethod( | 472 method_factory_.NewRunnableMethod( |
| 474 &BalloonViewImpl::DelayedClose, false)); | 473 &BalloonViewImpl::DelayedClose, false)); |
| 475 } | 474 } |
| 476 } | 475 } |
| 477 | 476 |
| 478 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { | 477 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { |
| 479 frame_container_ = NULL; | 478 frame_container_ = NULL; |
| 480 Close(false); | 479 Close(false); |
| 481 return FALSE; // Propagate. | 480 return FALSE; // Propagate. |
| 482 } | 481 } |
| OLD | NEW |