| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/native_app_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/apps/native_app_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/message_loop/message_pump_gtk.h" | 10 #include "base/message_loop/message_pump_gtk.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(window_)); | 139 GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(window_)); |
| 140 gdk_window_add_filter(window, | 140 gdk_window_add_filter(window, |
| 141 &NativeAppWindowGtk::OnXEventThunk, | 141 &NativeAppWindowGtk::OnXEventThunk, |
| 142 this); | 142 this); |
| 143 is_x_event_listened_ = true; | 143 is_x_event_listened_ = true; |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Add the keybinding registry. | 147 // Add the keybinding registry. |
| 148 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryGtk( | 148 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryGtk( |
| 149 shell_window_->profile(), | 149 Profile::FromBrowserContext(shell_window_->browser_context()), |
| 150 window_, | 150 window_, |
| 151 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 151 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
| 152 shell_window_)); | 152 shell_window_)); |
| 153 | 153 |
| 154 ui::ActiveWindowWatcherX::AddObserver(this); | 154 ui::ActiveWindowWatcherX::AddObserver(this); |
| 155 } | 155 } |
| 156 | 156 |
| 157 NativeAppWindowGtk::~NativeAppWindowGtk() { | 157 NativeAppWindowGtk::~NativeAppWindowGtk() { |
| 158 ui::ActiveWindowWatcherX::RemoveObserver(this); | 158 ui::ActiveWindowWatcherX::RemoveObserver(this); |
| 159 if (is_x_event_listened_) { | 159 if (is_x_event_listened_) { |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 // In that case, |content_thinks_its_fullscreen_| will be cleared, but we | 617 // In that case, |content_thinks_its_fullscreen_| will be cleared, but we |
| 618 // will fall back to |IsFullscreen| which will soon have the correct state. | 618 // will fall back to |IsFullscreen| which will soon have the correct state. |
| 619 return content_thinks_its_fullscreen_ || IsFullscreen(); | 619 return content_thinks_its_fullscreen_ || IsFullscreen(); |
| 620 } | 620 } |
| 621 | 621 |
| 622 bool NativeAppWindowGtk::IsDetached() const { | 622 bool NativeAppWindowGtk::IsDetached() const { |
| 623 return false; | 623 return false; |
| 624 } | 624 } |
| 625 | 625 |
| 626 void NativeAppWindowGtk::UpdateWindowIcon() { | 626 void NativeAppWindowGtk::UpdateWindowIcon() { |
| 627 Profile* profile = shell_window_->profile(); | 627 Profile* profile = |
| 628 Profile::FromBrowserContext(shell_window_->browser_context()); |
| 628 gfx::Image app_icon = shell_window_->app_icon(); | 629 gfx::Image app_icon = shell_window_->app_icon(); |
| 629 if (!app_icon.IsEmpty()) | 630 if (!app_icon.IsEmpty()) |
| 630 gtk_util::SetWindowIcon(window_, profile, app_icon.ToGdkPixbuf()); | 631 gtk_util::SetWindowIcon(window_, profile, app_icon.ToGdkPixbuf()); |
| 631 else | 632 else |
| 632 gtk_util::SetWindowIcon(window_, profile); | 633 gtk_util::SetWindowIcon(window_, profile); |
| 633 } | 634 } |
| 634 | 635 |
| 635 void NativeAppWindowGtk::UpdateWindowTitle() { | 636 void NativeAppWindowGtk::UpdateWindowTitle() { |
| 636 base::string16 title = shell_window_->GetTitle(); | 637 base::string16 title = shell_window_->GetTitle(); |
| 637 gtk_window_set_title(window_, base::UTF16ToUTF8(title).c_str()); | 638 gtk_window_set_title(window_, base::UTF16ToUTF8(title).c_str()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 hints_mask |= GDK_HINT_MAX_SIZE; | 716 hints_mask |= GDK_HINT_MAX_SIZE; |
| 716 } | 717 } |
| 717 if (hints_mask) { | 718 if (hints_mask) { |
| 718 gtk_window_set_geometry_hints( | 719 gtk_window_set_geometry_hints( |
| 719 window_, | 720 window_, |
| 720 GTK_WIDGET(window_), | 721 GTK_WIDGET(window_), |
| 721 &hints, | 722 &hints, |
| 722 static_cast<GdkWindowHints>(hints_mask)); | 723 static_cast<GdkWindowHints>(hints_mask)); |
| 723 } | 724 } |
| 724 } | 725 } |
| OLD | NEW |