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

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

Issue 14969012: components: Create web_modal component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-before-land Created 7 years, 7 months 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 (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/extensions/native_app_window_gtk.h" 5 #include "chrome/browser/ui/gtk/extensions/native_app_window_gtk.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h" 9 #include "chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h"
10 #include "chrome/browser/ui/gtk/gtk_util.h" 10 #include "chrome/browser/ui/gtk/gtk_util.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 gfx::Point NativeAppWindowGtk::GetDialogPosition(const gfx::Size& size) { 301 gfx::Point NativeAppWindowGtk::GetDialogPosition(const gfx::Size& size) {
302 gint current_width = 0; 302 gint current_width = 0;
303 gint current_height = 0; 303 gint current_height = 0;
304 gtk_window_get_size(window_, &current_width, &current_height); 304 gtk_window_get_size(window_, &current_width, &current_height);
305 return gfx::Point(current_width / 2 - size.width() / 2, 305 return gfx::Point(current_width / 2 - size.width() / 2,
306 current_height / 2 - size.height() / 2); 306 current_height / 2 - size.height() / 2);
307 } 307 }
308 308
309 void NativeAppWindowGtk::AddObserver( 309 void NativeAppWindowGtk::AddObserver(
310 WebContentsModalDialogHostObserver* observer) { 310 web_modal::WebContentsModalDialogHostObserver* observer) {
311 observer_list_.AddObserver(observer); 311 observer_list_.AddObserver(observer);
312 } 312 }
313 313
314 void NativeAppWindowGtk::RemoveObserver( 314 void NativeAppWindowGtk::RemoveObserver(
315 WebContentsModalDialogHostObserver* observer) { 315 web_modal::WebContentsModalDialogHostObserver* observer) {
316 observer_list_.RemoveObserver(observer); 316 observer_list_.RemoveObserver(observer);
317 } 317 }
318 318
319 void NativeAppWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { 319 void NativeAppWindowGtk::ActiveWindowChanged(GdkWindow* active_window) {
320 // Do nothing if we're in the process of closing the browser window. 320 // Do nothing if we're in the process of closing the browser window.
321 if (!window_) 321 if (!window_)
322 return; 322 return;
323 323
324 is_active_ = gtk_widget_get_window(GTK_WIDGET(window_)) == active_window; 324 is_active_ = gtk_widget_get_window(GTK_WIDGET(window_)) == active_window;
325 } 325 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), this, 359 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), this,
360 &NativeAppWindowGtk::OnDebouncedBoundsChanged); 360 &NativeAppWindowGtk::OnDebouncedBoundsChanged);
361 361
362 return FALSE; 362 return FALSE;
363 } 363 }
364 364
365 void NativeAppWindowGtk::OnDebouncedBoundsChanged() { 365 void NativeAppWindowGtk::OnDebouncedBoundsChanged() {
366 gtk_window_util::UpdateWindowPosition(this, &bounds_, &restored_bounds_); 366 gtk_window_util::UpdateWindowPosition(this, &bounds_, &restored_bounds_);
367 shell_window_->OnNativeWindowChanged(); 367 shell_window_->OnNativeWindowChanged();
368 368
369 FOR_EACH_OBSERVER(WebContentsModalDialogHostObserver, 369 FOR_EACH_OBSERVER(web_modal::WebContentsModalDialogHostObserver,
370 observer_list_, 370 observer_list_,
371 OnPositionRequiresUpdate()); 371 OnPositionRequiresUpdate());
372 } 372 }
373 373
374 gboolean NativeAppWindowGtk::OnWindowState(GtkWidget* sender, 374 gboolean NativeAppWindowGtk::OnWindowState(GtkWidget* sender,
375 GdkEventWindowState* event) { 375 GdkEventWindowState* event) {
376 state_ = event->new_window_state; 376 state_ = event->new_window_state;
377 377
378 if (content_thinks_its_fullscreen_ && 378 if (content_thinks_its_fullscreen_ &&
379 !(state_ & GDK_WINDOW_STATE_FULLSCREEN)) { 379 !(state_ & GDK_WINDOW_STATE_FULLSCREEN)) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 527
528 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions)); 528 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions));
529 } 529 }
530 530
531 // static 531 // static
532 NativeAppWindow* NativeAppWindow::Create( 532 NativeAppWindow* NativeAppWindow::Create(
533 ShellWindow* shell_window, 533 ShellWindow* shell_window,
534 const ShellWindow::CreateParams& params) { 534 const ShellWindow::CreateParams& params) {
535 return new NativeAppWindowGtk(shell_window, params); 535 return new NativeAppWindowGtk(shell_window, params);
536 } 536 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/extensions/native_app_window_gtk.h ('k') | chrome/browser/ui/gtk/login_prompt_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698