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 Profile::FromBrowserContext(shell_window_->browser_context()), | 149 shell_window_->profile(), |
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 = | 627 Profile* profile = shell_window_->profile(); |
628 Profile::FromBrowserContext(shell_window_->browser_context()); | |
629 gfx::Image app_icon = shell_window_->app_icon(); | 628 gfx::Image app_icon = shell_window_->app_icon(); |
630 if (!app_icon.IsEmpty()) | 629 if (!app_icon.IsEmpty()) |
631 gtk_util::SetWindowIcon(window_, profile, app_icon.ToGdkPixbuf()); | 630 gtk_util::SetWindowIcon(window_, profile, app_icon.ToGdkPixbuf()); |
632 else | 631 else |
633 gtk_util::SetWindowIcon(window_, profile); | 632 gtk_util::SetWindowIcon(window_, profile); |
634 } | 633 } |
635 | 634 |
636 void NativeAppWindowGtk::UpdateWindowTitle() { | 635 void NativeAppWindowGtk::UpdateWindowTitle() { |
637 base::string16 title = shell_window_->GetTitle(); | 636 base::string16 title = shell_window_->GetTitle(); |
638 gtk_window_set_title(window_, base::UTF16ToUTF8(title).c_str()); | 637 gtk_window_set_title(window_, base::UTF16ToUTF8(title).c_str()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 hints_mask |= GDK_HINT_MAX_SIZE; | 715 hints_mask |= GDK_HINT_MAX_SIZE; |
717 } | 716 } |
718 if (hints_mask) { | 717 if (hints_mask) { |
719 gtk_window_set_geometry_hints( | 718 gtk_window_set_geometry_hints( |
720 window_, | 719 window_, |
721 GTK_WIDGET(window_), | 720 GTK_WIDGET(window_), |
722 &hints, | 721 &hints, |
723 static_cast<GdkWindowHints>(hints_mask)); | 722 static_cast<GdkWindowHints>(hints_mask)); |
724 } | 723 } |
725 } | 724 } |
OLD | NEW |