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

Side by Side Diff: chrome/browser/ui/views/panels/panel_view.cc

Issue 320713004: Update panel layout immediately after the user has finished resizing a panel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 6 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/views/panels/panel_view.h" 5 #include "chrome/browser/ui/views/panels/panel_view.h"
6 6
7 #include <map> 7 #include <map>
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/host_desktop.h" 13 #include "chrome/browser/ui/host_desktop.h"
14 #include "chrome/browser/ui/panels/panel.h" 14 #include "chrome/browser/ui/panels/panel.h"
15 #include "chrome/browser/ui/panels/panel_bounds_animation.h" 15 #include "chrome/browser/ui/panels/panel_bounds_animation.h"
16 #include "chrome/browser/ui/panels/panel_manager.h" 16 #include "chrome/browser/ui/panels/panel_manager.h"
17 #include "chrome/browser/ui/panels/stacked_panel_collection.h" 17 #include "chrome/browser/ui/panels/stacked_panel_collection.h"
18 #include "chrome/browser/ui/views/auto_keep_alive.h" 18 #include "chrome/browser/ui/views/auto_keep_alive.h"
19 #include "chrome/browser/ui/views/panels/panel_frame_view.h" 19 #include "chrome/browser/ui/views/panels/panel_frame_view.h"
20 #include "content/public/browser/render_view_host.h" 20 #include "content/public/browser/render_view_host.h"
21 #include "content/public/browser/render_widget_host_view.h" 21 #include "content/public/browser/render_widget_host_view.h"
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "ui/aura/window.h"
24 #include "ui/aura/window_tree_host.h"
23 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
24 #include "ui/gfx/path.h" 26 #include "ui/gfx/path.h"
25 #include "ui/gfx/screen.h" 27 #include "ui/gfx/screen.h"
26 #include "ui/views/controls/button/image_button.h" 28 #include "ui/views/controls/button/image_button.h"
27 #include "ui/views/controls/webview/webview.h" 29 #include "ui/views/controls/webview/webview.h"
28 #include "ui/views/widget/widget.h" 30 #include "ui/views/widget/widget.h"
29 31
30 #if defined(OS_WIN) 32 #if defined(OS_WIN)
31 #include "base/win/windows_version.h" 33 #include "base/win/windows_version.h"
32 #include "chrome/browser/shell_integration.h" 34 #include "chrome/browser/shell_integration.h"
33 #include "chrome/browser/ui/views/panels/taskbar_window_thumbnailer_win.h" 35 #include "chrome/browser/ui/views/panels/taskbar_window_thumbnailer_win.h"
34 #include "ui/base/win/shell.h" 36 #include "ui/base/win/shell.h"
35 #include "ui/gfx/icon_util.h" 37 #include "ui/gfx/icon_util.h"
36 #include "ui/views/win/hwnd_util.h" 38 #include "ui/views/win/hwnd_util.h"
37 #endif 39 #endif
38 40
41 #if defined(USE_X11) && !defined(OS_CHROMEOS)
42 #include "chrome/browser/ui/views/panels/x11_panel_resizer.h"
43 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
44 #endif
45
39 namespace { 46 namespace {
40 47
41 #if defined(OS_WIN) 48 #if defined(OS_WIN)
42 // If the height of a stacked panel shrinks below this threshold during the 49 // If the height of a stacked panel shrinks below this threshold during the
43 // user resizing, it will be treated as minimized. 50 // user resizing, it will be treated as minimized.
44 const int kStackedPanelHeightShrinkThresholdToBecomeMinimized = 51 const int kStackedPanelHeightShrinkThresholdToBecomeMinimized =
45 panel::kTitlebarHeight + 20; 52 panel::kTitlebarHeight + 20;
46 #endif 53 #endif
47 54
48 // Supported accelerators. 55 // Supported accelerators.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 iter->first, ui::AcceleratorManager::kNormalPriority, this); 307 iter->first, ui::AcceleratorManager::kNormalPriority, this);
301 } 308 }
302 309
303 #if defined(OS_WIN) 310 #if defined(OS_WIN)
304 ui::win::SetAppIdForWindow( 311 ui::win::SetAppIdForWindow(
305 ShellIntegration::GetAppModelIdForProfile( 312 ShellIntegration::GetAppModelIdForProfile(
306 base::UTF8ToWide(panel->app_name()), panel->profile()->GetPath()), 313 base::UTF8ToWide(panel->app_name()), panel->profile()->GetPath()),
307 views::HWNDForWidget(window_)); 314 views::HWNDForWidget(window_));
308 ui::win::PreventWindowFromPinning(views::HWNDForWidget(window_)); 315 ui::win::PreventWindowFromPinning(views::HWNDForWidget(window_));
309 #endif 316 #endif
317
318 #if defined(USE_X11) && !defined(OS_CHROMEOS)
319 // Swap the default non client event handler with one which handles resizes
320 // for panels entirely within Chrome. This is needed because it is not
321 // possible to tell when a resize performed by the window manager ends.
322 views::DesktopWindowTreeHostX11* host =
323 views::DesktopWindowTreeHostX11::GetHostForXID(
324 window_->GetNativeView()->GetHost()->GetAcceleratedWidget());
325 scoped_ptr<ui::EventHandler> resizer(
326 new X11PanelResizer(panel_.get(), window_->GetNativeWindow()));
327 host->SwapNonClientEventHandler(resizer.Pass());
328 #endif
310 } 329 }
311 330
312 PanelView::~PanelView() { 331 PanelView::~PanelView() {
313 } 332 }
314 333
315 void PanelView::ShowPanel() { 334 void PanelView::ShowPanel() {
316 ShowPanelInactive(); 335 ShowPanelInactive();
317 ActivatePanel(); 336 ActivatePanel();
318 } 337 }
319 338
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 // SWP_FRAMECHANGED flag must be called in order for the cached window data 1144 // SWP_FRAMECHANGED flag must be called in order for the cached window data
1126 // to be updated properly. 1145 // to be updated properly.
1127 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).a spx 1146 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).a spx
1128 if (update_frame) { 1147 if (update_frame) {
1129 ::SetWindowPos(native_window, NULL, 0, 0, 0, 0, 1148 ::SetWindowPos(native_window, NULL, 0, 0, 0, 0,
1130 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | 1149 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE |
1131 SWP_NOZORDER | SWP_NOACTIVATE); 1150 SWP_NOZORDER | SWP_NOACTIVATE);
1132 } 1151 }
1133 } 1152 }
1134 #endif 1153 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_resize_controller.cc ('k') | chrome/browser/ui/views/panels/x11_panel_resizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698