| 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/bubble/bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/ui/gtk/bubble/bubble_accelerators_gtk.h" | 10 #include "chrome/browser/ui/gtk/bubble/bubble_accelerators_gtk.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 signals_.Connect(toplevel_window_, "destroy", | 172 signals_.Connect(toplevel_window_, "destroy", |
| 173 G_CALLBACK(gtk_widget_destroyed), &toplevel_window_); | 173 G_CALLBACK(gtk_widget_destroyed), &toplevel_window_); |
| 174 | 174 |
| 175 gtk_widget_show_all(window_); | 175 gtk_widget_show_all(window_); |
| 176 | 176 |
| 177 if (grab_input_) { | 177 if (grab_input_) { |
| 178 gtk_grab_add(window_); | 178 gtk_grab_add(window_); |
| 179 GrabPointerAndKeyboard(); | 179 GrabPointerAndKeyboard(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 182 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 183 Source<ThemeService>(theme_service_)); | 183 Source<ThemeService>(theme_service_)); |
| 184 theme_service_->InitThemesFor(this); | 184 theme_service_->InitThemesFor(this); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // NOTE: This seems a bit overcomplicated, but it requires a bunch of careful | 187 // NOTE: This seems a bit overcomplicated, but it requires a bunch of careful |
| 188 // fudging to get the pixels rasterized exactly where we want them, the arrow to | 188 // fudging to get the pixels rasterized exactly where we want them, the arrow to |
| 189 // have a 1 pixel point, etc. | 189 // have a 1 pixel point, etc. |
| 190 // TODO(deanm): Windows draws with Skia and uses some PNG images for the | 190 // TODO(deanm): Windows draws with Skia and uses some PNG images for the |
| 191 // corners. This is a lot more work, but they get anti-aliasing. | 191 // corners. This is a lot more work, but they get anti-aliasing. |
| 192 // static | 192 // static |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 gtk_window_move(GTK_WINDOW(window_), screen_x, screen_y); | 337 gtk_window_move(GTK_WINDOW(window_), screen_x, screen_y); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void BubbleGtk::StackWindow() { | 340 void BubbleGtk::StackWindow() { |
| 341 // Stack our window directly above the toplevel window. | 341 // Stack our window directly above the toplevel window. |
| 342 if (toplevel_window_) | 342 if (toplevel_window_) |
| 343 ui::StackPopupWindow(window_, GTK_WIDGET(toplevel_window_)); | 343 ui::StackPopupWindow(window_, GTK_WIDGET(toplevel_window_)); |
| 344 } | 344 } |
| 345 | 345 |
| 346 void BubbleGtk::Observe(NotificationType type, | 346 void BubbleGtk::Observe(int type, |
| 347 const NotificationSource& source, | 347 const NotificationSource& source, |
| 348 const NotificationDetails& details) { | 348 const NotificationDetails& details) { |
| 349 DCHECK_EQ(type.value, NotificationType::BROWSER_THEME_CHANGED); | 349 DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_THEME_CHANGED); |
| 350 if (theme_service_->UsingNativeTheme() && match_system_theme_) { | 350 if (theme_service_->UsingNativeTheme() && match_system_theme_) { |
| 351 gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, NULL); | 351 gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, NULL); |
| 352 } else { | 352 } else { |
| 353 // Set the background color, so we don't need to paint it manually. | 353 // Set the background color, so we don't need to paint it manually. |
| 354 gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, &kBackgroundColor); | 354 gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, &kBackgroundColor); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 | 357 |
| 358 void BubbleGtk::HandlePointerAndKeyboardUngrabbedByContent() { | 358 void BubbleGtk::HandlePointerAndKeyboardUngrabbedByContent() { |
| 359 if (grab_input_) | 359 if (grab_input_) |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 gboolean BubbleGtk::OnToplevelUnmap(GtkWidget* widget, GdkEvent* event) { | 527 gboolean BubbleGtk::OnToplevelUnmap(GtkWidget* widget, GdkEvent* event) { |
| 528 Close(); | 528 Close(); |
| 529 return FALSE; | 529 return FALSE; |
| 530 } | 530 } |
| 531 | 531 |
| 532 void BubbleGtk::OnAnchorAllocate(GtkWidget* widget, | 532 void BubbleGtk::OnAnchorAllocate(GtkWidget* widget, |
| 533 GtkAllocation* allocation) { | 533 GtkAllocation* allocation) { |
| 534 if (!UpdateArrowLocation(false)) | 534 if (!UpdateArrowLocation(false)) |
| 535 MoveWindow(); | 535 MoveWindow(); |
| 536 } | 536 } |
| OLD | NEW |