| OLD | NEW |
| 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/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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "chrome/browser/extensions/extension_host.h" | 16 #include "chrome/browser/extensions/extension_host.h" |
| 17 #include "chrome/browser/extensions/extension_process_manager.h" | 17 #include "chrome/browser/extensions/extension_process_manager.h" |
| 18 #include "chrome/browser/notifications/balloon.h" | 18 #include "chrome/browser/notifications/balloon.h" |
| 19 #include "chrome/browser/notifications/desktop_notification_service.h" | 19 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 20 #include "chrome/browser/notifications/notification.h" | 20 #include "chrome/browser/notifications/notification.h" |
| 21 #include "chrome/browser/notifications/notification_options_menu_model.h" | 21 #include "chrome/browser/notifications/notification_options_menu_model.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
| 24 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
| 25 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
| 26 #include "chrome/browser/ui/gtk/custom_button.h" | 26 #include "chrome/browser/ui/gtk/custom_button.h" |
| 27 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 28 #include "chrome/browser/ui/gtk/gtk_util.h" | 27 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 29 #include "chrome/browser/ui/gtk/menu_gtk.h" | 28 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 30 #include "chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h" | 29 #include "chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h" |
| 31 #include "chrome/browser/ui/gtk/rounded_window.h" | 30 #include "chrome/browser/ui/gtk/rounded_window.h" |
| 31 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 32 #include "chrome/common/chrome_notification_types.h" | 32 #include "chrome/common/chrome_notification_types.h" |
| 33 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
| 34 #include "content/browser/renderer_host/render_view_host.h" | 34 #include "content/browser/renderer_host/render_view_host.h" |
| 35 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
| 36 #include "content/public/browser/render_widget_host_view.h" | 36 #include "content/public/browser/render_widget_host_view.h" |
| 37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| 39 #include "grit/theme_resources.h" | 39 #include "grit/theme_resources.h" |
| 40 #include "grit/theme_resources_standard.h" | 40 #include "grit/theme_resources_standard.h" |
| 41 #include "ui/base/animation/slide_animation.h" | 41 #include "ui/base/animation/slide_animation.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 gtk_window_resize(GTK_WINDOW(frame_container_), | 202 gtk_window_resize(GTK_WINDOW(frame_container_), |
| 203 frame_position.width(), frame_position.height()); | 203 frame_position.width(), frame_position.height()); |
| 204 gtk_window_move(GTK_WINDOW(frame_container_), | 204 gtk_window_move(GTK_WINDOW(frame_container_), |
| 205 frame_position.x(), frame_position.y()); | 205 frame_position.x(), frame_position.y()); |
| 206 | 206 |
| 207 gfx::Rect contents_rect = GetContentsRectangle(); | 207 gfx::Rect contents_rect = GetContentsRectangle(); |
| 208 html_contents_->UpdateActualSize(contents_rect.size()); | 208 html_contents_->UpdateActualSize(contents_rect.size()); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void BalloonViewImpl::Show(Balloon* balloon) { | 211 void BalloonViewImpl::Show(Balloon* balloon) { |
| 212 theme_service_ = GtkThemeService::GetFrom(balloon->profile()); | 212 theme_service_ = ThemeServiceGtk::GetFrom(balloon->profile()); |
| 213 | 213 |
| 214 const std::string source_label_text = l10n_util::GetStringFUTF8( | 214 const std::string source_label_text = l10n_util::GetStringFUTF8( |
| 215 IDS_NOTIFICATION_BALLOON_SOURCE_LABEL, | 215 IDS_NOTIFICATION_BALLOON_SOURCE_LABEL, |
| 216 balloon->notification().display_source()); | 216 balloon->notification().display_source()); |
| 217 const std::string options_text = | 217 const std::string options_text = |
| 218 l10n_util::GetStringUTF8(IDS_NOTIFICATION_OPTIONS_MENU_LABEL); | 218 l10n_util::GetStringUTF8(IDS_NOTIFICATION_OPTIONS_MENU_LABEL); |
| 219 const std::string dismiss_text = | 219 const std::string dismiss_text = |
| 220 l10n_util::GetStringUTF8(IDS_NOTIFICATION_BALLOON_DISMISS_LABEL); | 220 l10n_util::GetStringUTF8(IDS_NOTIFICATION_BALLOON_DISMISS_LABEL); |
| 221 | 221 |
| 222 balloon_ = balloon; | 222 balloon_ = balloon; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 weak_factory_.GetWeakPtr(), | 482 weak_factory_.GetWeakPtr(), |
| 483 false)); | 483 false)); |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 | 486 |
| 487 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { | 487 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { |
| 488 frame_container_ = NULL; | 488 frame_container_ = NULL; |
| 489 Close(false); | 489 Close(false); |
| 490 return FALSE; // Propagate. | 490 return FALSE; // Propagate. |
| 491 } | 491 } |
| OLD | NEW |