Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: chrome/browser/ui/gtk/apps/native_app_window_gtk.cc

Issue 59043013: Add flag to enable immersive fullscreen for v2 apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 gtk_window_util::UpdateWindowPosition(this, &bounds_, &restored_bounds_); 448 gtk_window_util::UpdateWindowPosition(this, &bounds_, &restored_bounds_);
449 shell_window_->OnNativeWindowChanged(); 449 shell_window_->OnNativeWindowChanged();
450 450
451 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, 451 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver,
452 observer_list_, 452 observer_list_,
453 OnPositionRequiresUpdate()); 453 OnPositionRequiresUpdate());
454 454
455 // Fullscreen of non-resizable windows requires them to be made resizable 455 // Fullscreen of non-resizable windows requires them to be made resizable
456 // first. After that takes effect and OnConfigure is called we transition 456 // first. After that takes effect and OnConfigure is called we transition
457 // to fullscreen. 457 // to fullscreen.
458 if (!IsFullscreen() && IsFullscreenOrPending()) { 458 if (!IsFullscreen() && content_thinks_its_fullscreen_) {
459 gtk_window_fullscreen(window_); 459 gtk_window_fullscreen(window_);
460 } 460 }
461 461
462 // maximize_pending_ is the boolean that lets us know that the window is in 462 // maximize_pending_ is the boolean that lets us know that the window is in
463 // the process of being maximized but was set as not resizable. 463 // the process of being maximized but was set as not resizable.
464 // This function will be called twice during the maximization process: 464 // This function will be called twice during the maximization process:
465 // 1. gtk_window_maximize() is called to maximize the window; 465 // 1. gtk_window_maximize() is called to maximize the window;
466 // 2. gtk_set_resizable(, FALSE) is called to make the window no longer 466 // 2. gtk_set_resizable(, FALSE) is called to make the window no longer
467 // resizable. 467 // resizable.
468 // gtk_window_maximize() will cause ::OnConfigureDebounced to be called 468 // gtk_window_maximize() will cause ::OnConfigureDebounced to be called
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if (has_hit_titlebar || has_hit_edge) 586 if (has_hit_titlebar || has_hit_edge)
587 gdk_window_lower(gdk_window); 587 gdk_window_lower(gdk_window);
588 return TRUE; 588 return TRUE;
589 } 589 }
590 590
591 return FALSE; 591 return FALSE;
592 } 592 }
593 593
594 // NativeAppWindow implementation: 594 // NativeAppWindow implementation:
595 595
596 void NativeAppWindowGtk::SetFullscreen(bool fullscreen) { 596 void NativeAppWindowGtk::SetFullscreen(ShellWindow::FullscreenType type) {
597 bool fullscreen = (type != ShellWindow::FULLSCREEN_TYPE_NONE);
597 content_thinks_its_fullscreen_ = fullscreen; 598 content_thinks_its_fullscreen_ = fullscreen;
598 if (fullscreen){ 599 if (fullscreen) {
599 if (resizable_) { 600 if (resizable_) {
600 gtk_window_fullscreen(window_); 601 gtk_window_fullscreen(window_);
601 } else { 602 } else {
602 // We must first make the window resizable. That won't take effect 603 // We must first make the window resizable. That won't take effect
603 // immediately, so OnConfigureDebounced completes the fullscreen call. 604 // immediately, so OnConfigureDebounced completes the fullscreen call.
604 gtk_window_set_resizable(window_, TRUE); 605 gtk_window_set_resizable(window_, TRUE);
605 } 606 }
606 } else { 607 } else {
607 gtk_window_unfullscreen(window_); 608 gtk_window_unfullscreen(window_);
608 if (!resizable_) 609 if (!resizable_)
609 gtk_window_set_resizable(window_, FALSE); 610 gtk_window_set_resizable(window_, FALSE);
610 } 611 }
611 } 612 }
612 613
613 bool NativeAppWindowGtk::IsFullscreenOrPending() const { 614 bool NativeAppWindowGtk::SupportsImmersiveFullscreen() const {
614 // |content_thinks_its_fullscreen_| is used when transitioning, and when 615 return false;
615 // the state change will not be made for some time. However, it is possible
616 // for a state update to be made before the final fullscreen state comes.
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.
619 return content_thinks_its_fullscreen_ || IsFullscreen();
620 } 616 }
621 617
622 bool NativeAppWindowGtk::IsDetached() const { 618 bool NativeAppWindowGtk::IsDetached() const {
623 return false; 619 return false;
624 } 620 }
625 621
626 void NativeAppWindowGtk::UpdateWindowIcon() { 622 void NativeAppWindowGtk::UpdateWindowIcon() {
627 Profile* profile = shell_window_->profile(); 623 Profile* profile = shell_window_->profile();
628 gfx::Image app_icon = shell_window_->app_icon(); 624 gfx::Image app_icon = shell_window_->app_icon();
629 if (!app_icon.IsEmpty()) 625 if (!app_icon.IsEmpty())
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 hints_mask |= GDK_HINT_MAX_SIZE; 707 hints_mask |= GDK_HINT_MAX_SIZE;
712 } 708 }
713 if (hints_mask) { 709 if (hints_mask) {
714 gtk_window_set_geometry_hints( 710 gtk_window_set_geometry_hints(
715 window_, 711 window_,
716 GTK_WIDGET(window_), 712 GTK_WIDGET(window_),
717 &hints, 713 &hints,
718 static_cast<GdkWindowHints>(hints_mask)); 714 static_cast<GdkWindowHints>(hints_mask));
719 } 715 }
720 } 716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698