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/browser_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
16 #include "base/environment.h" | 16 #include "base/environment.h" |
17 #include "base/i18n/file_util_icu.h" | 17 #include "base/i18n/file_util_icu.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/memory/singleton.h" | 20 #include "base/memory/singleton.h" |
21 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
22 #include "base/nix/xdg_util.h" | 22 #include "base/nix/xdg_util.h" |
23 #include "base/path_service.h" | 23 #include "base/path_service.h" |
24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
25 #include "base/task.h" | |
26 #include "base/time.h" | 25 #include "base/time.h" |
27 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
28 #include "chrome/app/chrome_command_ids.h" | 27 #include "chrome/app/chrome_command_ids.h" |
29 #include "chrome/browser/bookmarks/bookmark_utils.h" | 28 #include "chrome/browser/bookmarks/bookmark_utils.h" |
30 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
31 #include "chrome/browser/debugger/devtools_window.h" | 30 #include "chrome/browser/debugger/devtools_window.h" |
32 #include "chrome/browser/download/download_item_model.h" | 31 #include "chrome/browser/download/download_item_model.h" |
33 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
34 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 33 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
35 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 // expectations of BrowserList, we should run the BrowserWindowGtk destructor | 1573 // expectations of BrowserList, we should run the BrowserWindowGtk destructor |
1575 // not now, but after the run loop goes back to process messages. Otherwise | 1574 // not now, but after the run loop goes back to process messages. Otherwise |
1576 // we will remove ourself from BrowserList while it's being iterated. | 1575 // we will remove ourself from BrowserList while it's being iterated. |
1577 // Additionally, now that we know the window is gone, we need to make sure to | 1576 // Additionally, now that we know the window is gone, we need to make sure to |
1578 // set window_ to NULL, otherwise we will try to close the window again when | 1577 // set window_ to NULL, otherwise we will try to close the window again when |
1579 // we call Close() in the destructor. | 1578 // we call Close() in the destructor. |
1580 // | 1579 // |
1581 // We don't want to use DeleteSoon() here since it won't work on a nested pump | 1580 // We don't want to use DeleteSoon() here since it won't work on a nested pump |
1582 // (like in UI tests). | 1581 // (like in UI tests). |
1583 MessageLoop::current()->PostTask( | 1582 MessageLoop::current()->PostTask( |
1584 FROM_HERE, base::Bind(&DeletePointer<BrowserWindowGtk>, this)); | 1583 FROM_HERE, base::Bind(&base::DeletePointer<BrowserWindowGtk>, this)); |
1585 } | 1584 } |
1586 | 1585 |
1587 void BrowserWindowGtk::UnMaximize() { | 1586 void BrowserWindowGtk::UnMaximize() { |
1588 gtk_window_unmaximize(window_); | 1587 gtk_window_unmaximize(window_); |
1589 | 1588 |
1590 // It can happen that you end up with a window whose restore size is the same | 1589 // It can happen that you end up with a window whose restore size is the same |
1591 // as the size of the screen, so unmaximizing it merely remaximizes it due to | 1590 // as the size of the screen, so unmaximizing it merely remaximizes it due to |
1592 // the same WM feature that SetWindowSize() works around. We try to detect | 1591 // the same WM feature that SetWindowSize() works around. We try to detect |
1593 // this and resize the window to work around the issue. | 1592 // this and resize the window to work around the issue. |
1594 if (bounds_.size() == restored_bounds_.size()) | 1593 if (bounds_.size() == restored_bounds_.size()) |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2515 wm_type == ui::WM_OPENBOX || | 2514 wm_type == ui::WM_OPENBOX || |
2516 wm_type == ui::WM_XFWM4); | 2515 wm_type == ui::WM_XFWM4); |
2517 } | 2516 } |
2518 | 2517 |
2519 // static | 2518 // static |
2520 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2519 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2521 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2520 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
2522 browser_window_gtk->Init(); | 2521 browser_window_gtk->Init(); |
2523 return browser_window_gtk; | 2522 return browser_window_gtk; |
2524 } | 2523 } |
OLD | NEW |