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

Side by Side Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 9015021: Remove DeleteTask and convert remaining users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix last Linux gotchas (upload attempt #2) Created 8 years, 11 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) 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/command_line.h" 14 #include "base/command_line.h"
14 #include "base/debug/trace_event.h" 15 #include "base/debug/trace_event.h"
15 #include "base/environment.h" 16 #include "base/environment.h"
16 #include "base/i18n/file_util_icu.h" 17 #include "base/i18n/file_util_icu.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/singleton.h" 20 #include "base/memory/singleton.h"
20 #include "base/message_loop.h" 21 #include "base/message_loop.h"
21 #include "base/nix/xdg_util.h" 22 #include "base/nix/xdg_util.h"
22 #include "base/path_service.h" 23 #include "base/path_service.h"
23 #include "base/string_util.h" 24 #include "base/string_util.h"
25 #include "base/task.h"
24 #include "base/time.h" 26 #include "base/time.h"
25 #include "base/utf_string_conversions.h" 27 #include "base/utf_string_conversions.h"
26 #include "chrome/app/chrome_command_ids.h" 28 #include "chrome/app/chrome_command_ids.h"
27 #include "chrome/browser/bookmarks/bookmark_utils.h" 29 #include "chrome/browser/bookmarks/bookmark_utils.h"
28 #include "chrome/browser/browser_process.h" 30 #include "chrome/browser/browser_process.h"
29 #include "chrome/browser/debugger/devtools_window.h" 31 #include "chrome/browser/debugger/devtools_window.h"
30 #include "chrome/browser/download/download_item_model.h" 32 #include "chrome/browser/download/download_item_model.h"
31 #include "chrome/browser/prefs/pref_service.h" 33 #include "chrome/browser/prefs/pref_service.h"
32 #include "chrome/browser/prefs/scoped_user_pref_update.h" 34 #include "chrome/browser/prefs/scoped_user_pref_update.h"
33 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 // call stack). In order to not reenter Close(), and to also follow the 1573 // call stack). In order to not reenter Close(), and to also follow the
1572 // expectations of BrowserList, we should run the BrowserWindowGtk destructor 1574 // expectations of BrowserList, we should run the BrowserWindowGtk destructor
1573 // not now, but after the run loop goes back to process messages. Otherwise 1575 // not now, but after the run loop goes back to process messages. Otherwise
1574 // we will remove ourself from BrowserList while it's being iterated. 1576 // we will remove ourself from BrowserList while it's being iterated.
1575 // Additionally, now that we know the window is gone, we need to make sure to 1577 // Additionally, now that we know the window is gone, we need to make sure to
1576 // set window_ to NULL, otherwise we will try to close the window again when 1578 // set window_ to NULL, otherwise we will try to close the window again when
1577 // we call Close() in the destructor. 1579 // we call Close() in the destructor.
1578 // 1580 //
1579 // We don't want to use DeleteSoon() here since it won't work on a nested pump 1581 // We don't want to use DeleteSoon() here since it won't work on a nested pump
1580 // (like in UI tests). 1582 // (like in UI tests).
1581 MessageLoop::current()->PostTask(FROM_HERE, 1583 MessageLoop::current()->PostTask(
1582 new DeleteTask<BrowserWindowGtk>(this)); 1584 FROM_HERE, base::Bind(&DeletePointer<BrowserWindowGtk>, this));
1583 } 1585 }
1584 1586
1585 void BrowserWindowGtk::UnMaximize() { 1587 void BrowserWindowGtk::UnMaximize() {
1586 gtk_window_unmaximize(window_); 1588 gtk_window_unmaximize(window_);
1587 1589
1588 // It can happen that you end up with a window whose restore size is the same 1590 // It can happen that you end up with a window whose restore size is the same
1589 // as the size of the screen, so unmaximizing it merely remaximizes it due to 1591 // as the size of the screen, so unmaximizing it merely remaximizes it due to
1590 // the same WM feature that SetWindowSize() works around. We try to detect 1592 // the same WM feature that SetWindowSize() works around. We try to detect
1591 // this and resize the window to work around the issue. 1593 // this and resize the window to work around the issue.
1592 if (bounds_.size() == restored_bounds_.size()) 1594 if (bounds_.size() == restored_bounds_.size())
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 wm_type == ui::WM_OPENBOX || 2515 wm_type == ui::WM_OPENBOX ||
2514 wm_type == ui::WM_XFWM4); 2516 wm_type == ui::WM_XFWM4);
2515 } 2517 }
2516 2518
2517 // static 2519 // static
2518 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2520 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2519 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); 2521 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser);
2520 browser_window_gtk->Init(); 2522 browser_window_gtk->Init();
2521 return browser_window_gtk; 2523 return browser_window_gtk;
2522 } 2524 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.h ('k') | chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698