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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 7677001: Some fixes to panel support on Windows: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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/panels/panel_browser_view.h" 5 #include "chrome/browser/ui/panels/panel_browser_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/ui/panels/panel.h" 8 #include "chrome/browser/ui/panels/panel.h"
9 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" 9 #include "chrome/browser/ui/panels/panel_browser_frame_view.h"
10 #include "chrome/browser/ui/panels/panel_manager.h" 10 #include "chrome/browser/ui/panels/panel_manager.h"
11 #include "chrome/browser/ui/panels/panel_mouse_watcher_win.h" 11 #include "chrome/browser/ui/panels/panel_mouse_watcher_win.h"
12 #include "chrome/browser/ui/views/frame/browser_frame.h" 12 #include "chrome/browser/ui/views/frame/browser_frame.h"
13 #include "grit/chromium_strings.h" 13 #include "grit/chromium_strings.h"
14 #include "ui/base/animation/slide_animation.h" 14 #include "ui/base/animation/slide_animation.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "views/widget/widget.h" 16 #include "views/widget/widget.h"
17 17
18 namespace { 18 namespace {
19 // This value is experimental and subjective. 19 // This value is experimental and subjective.
20 const int kSetBoundsAnimationMs = 200; 20 const int kSetBoundsAnimationMs = 180;
21
22 // The panel can be fully minimized to 3-pixel lines.
23 const int kFullyMinimizedHeight = 3;
24 21
25 // Delay before click-to-minimize is allowed after the attention has been 22 // Delay before click-to-minimize is allowed after the attention has been
26 // cleared. 23 // cleared.
27 const base::TimeDelta kSuspendMinimizeOnClickIntervalMs = 24 const base::TimeDelta kSuspendMinimizeOnClickIntervalMs =
28 base::TimeDelta::FromMilliseconds(500); 25 base::TimeDelta::FromMilliseconds(500);
29 } 26 }
30 27
31 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel, 28 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel,
32 const gfx::Rect& bounds) { 29 const gfx::Rect& bounds) {
33 PanelBrowserView* view = new PanelBrowserView(browser, panel, bounds); 30 PanelBrowserView* view = new PanelBrowserView(browser, panel, bounds);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 Panel::ExpansionState expansion_state) { 186 Panel::ExpansionState expansion_state) {
190 int height; 187 int height;
191 switch (expansion_state) { 188 switch (expansion_state) {
192 case Panel::EXPANDED: 189 case Panel::EXPANDED:
193 height = original_height_; 190 height = original_height_;
194 break; 191 break;
195 case Panel::TITLE_ONLY: 192 case Panel::TITLE_ONLY:
196 height = GetFrameView()->NonClientTopBorderHeight(); 193 height = GetFrameView()->NonClientTopBorderHeight();
197 break; 194 break;
198 case Panel::MINIMIZED: 195 case Panel::MINIMIZED:
199 height = kFullyMinimizedHeight; 196 height = PanelBrowserFrameView::MinimizedPanelHeight();
200 197
201 // Start the mouse watcher so that we can bring up the minimized panels. 198 // Start the mouse watcher so that we can bring up the minimized panels.
202 // TODO(jianli): Need to support mouse watching in ChromeOS. 199 // TODO(jianli): Need to support mouse watching in ChromeOS.
203 #if defined(OS_WIN) 200 #if defined(OS_WIN)
204 EnsureMouseWatcherStarted(); 201 EnsureMouseWatcherStarted();
205 #endif 202 #endif
206 break; 203 break;
207 default: 204 default:
208 NOTREACHED(); 205 NOTREACHED();
209 height = original_height_; 206 height = original_height_;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 346 }
350 347
351 Panel::ExpansionState new_expansion_state = 348 Panel::ExpansionState new_expansion_state =
352 (panel_->expansion_state() != Panel::EXPANDED) ? Panel::EXPANDED 349 (panel_->expansion_state() != Panel::EXPANDED) ? Panel::EXPANDED
353 : Panel::MINIMIZED; 350 : Panel::MINIMIZED;
354 panel_->SetExpansionState(new_expansion_state); 351 panel_->SetExpansionState(new_expansion_state);
355 return true; 352 return true;
356 } 353 }
357 354
358 bool PanelBrowserView::OnTitlebarMouseCaptureLost() { 355 bool PanelBrowserView::OnTitlebarMouseCaptureLost() {
359 return EndDragging(true); 356 if (mouse_dragging_)
357 return EndDragging(true);
358 return true;
360 } 359 }
361 360
362 bool PanelBrowserView::EndDragging(bool cancelled) { 361 bool PanelBrowserView::EndDragging(bool cancelled) {
363 // Only handle clicks that started in our window. 362 // Only handle clicks that started in our window.
364 if (!mouse_pressed_) 363 if (!mouse_pressed_)
365 return false; 364 return false;
366 mouse_pressed_ = false; 365 mouse_pressed_ = false;
367 366
368 if (!mouse_dragging_) 367 if (!mouse_dragging_)
369 cancelled = true; 368 cancelled = true;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 current_bounds.x() + delta_x, current_bounds.y() + delta_y)); 413 current_bounds.x() + delta_x, current_bounds.y() + delta_y));
415 } 414 }
416 415
417 void NativePanelTestingWin::CancelDragTitlebar() { 416 void NativePanelTestingWin::CancelDragTitlebar() {
418 panel_browser_view_->OnTitlebarMouseCaptureLost(); 417 panel_browser_view_->OnTitlebarMouseCaptureLost();
419 } 418 }
420 419
421 void NativePanelTestingWin::FinishDragTitlebar() { 420 void NativePanelTestingWin::FinishDragTitlebar() {
422 panel_browser_view_->OnTitlebarMouseReleased(); 421 panel_browser_view_->OnTitlebarMouseReleased();
423 } 422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698