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

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

Issue 8775023: Remove static initialization from the panels code. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/panels/panel_browser_window_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/ui/panels/panel.h" 9 #include "chrome/browser/ui/panels/panel.h"
10 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" 10 #include "chrome/browser/ui/panels/panel_browser_frame_view.h"
11 #include "chrome/browser/ui/panels/panel_manager.h" 11 #include "chrome/browser/ui/panels/panel_manager.h"
12 #include "chrome/browser/ui/views/frame/browser_frame.h" 12 #include "chrome/browser/ui/views/frame/browser_frame.h"
13 #include "chrome/browser/ui/webui/task_manager_dialog.h" 13 #include "chrome/browser/ui/webui/task_manager_dialog.h"
14 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "content/public/browser/notification_service.h" 16 #include "content/public/browser/notification_service.h"
17 #include "grit/chromium_strings.h" 17 #include "grit/chromium_strings.h"
18 #include "ui/base/animation/slide_animation.h" 18 #include "ui/base/animation/slide_animation.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/views/controls/label.h" 20 #include "ui/views/controls/label.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 namespace { 23 namespace {
24 // This value is experimental and subjective. 24 // This value is experimental and subjective.
25 const int kSetBoundsAnimationMs = 180; 25 const int kSetBoundsAnimationMs = 180;
26 26
27 // The threshold to differentiate the short click and long click. 27 // The threshold to differentiate the short click and long click.
28 const base::TimeDelta kShortClickThresholdMs = 28 const int kShortClickThresholdMs = 200;
29 base::TimeDelta::FromMilliseconds(200);
30 29
31 // Delay before click-to-minimize is allowed after the attention has been 30 // Delay before click-to-minimize is allowed after the attention has been
32 // cleared. 31 // cleared.
33 const base::TimeDelta kSuspendMinimizeOnClickIntervalMs = 32 const int kSuspendMinimizeOnClickIntervalMs = 500;
34 base::TimeDelta::FromMilliseconds(500);
35 33
36 } 34 }
37 35
38 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel, 36 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel,
39 const gfx::Rect& bounds) { 37 const gfx::Rect& bounds) {
40 PanelBrowserView* view = new PanelBrowserView(browser, panel, bounds); 38 PanelBrowserView* view = new PanelBrowserView(browser, panel, bounds);
41 (new BrowserFrame(view))->InitBrowserFrame(); 39 (new BrowserFrame(view))->InitBrowserFrame();
42 return view; 40 return view;
43 } 41 }
44 42
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 432
435 // If the panel drag was cancelled before the mouse is released, do not treat 433 // If the panel drag was cancelled before the mouse is released, do not treat
436 // this as a click. 434 // this as a click.
437 if (mouse_dragging_state_ != NO_DRAGGING) 435 if (mouse_dragging_state_ != NO_DRAGGING)
438 return true; 436 return true;
439 437
440 // Do not minimize the panel when we just clear the attention state. This is 438 // Do not minimize the panel when we just clear the attention state. This is
441 // a hack to prevent the panel from being minimized when the user clicks on 439 // a hack to prevent the panel from being minimized when the user clicks on
442 // the title-bar to clear the attention. 440 // the title-bar to clear the attention.
443 if (panel_->expansion_state() == Panel::EXPANDED && 441 if (panel_->expansion_state() == Panel::EXPANDED &&
444 base::TimeTicks::Now() < attention_cleared_time_ + 442 base::TimeTicks::Now() - attention_cleared_time_ <
445 kSuspendMinimizeOnClickIntervalMs) { 443 base::TimeDelta::FromMilliseconds(kSuspendMinimizeOnClickIntervalMs)) {
446 return true; 444 return true;
447 } 445 }
448 446
449 // Do not minimize the panel if it is long click. 447 // Do not minimize the panel if it is long click.
450 if (base::TimeTicks::Now() - mouse_pressed_time_ > kShortClickThresholdMs) 448 if (base::TimeTicks::Now() - mouse_pressed_time_ >
449 base::TimeDelta::FromMilliseconds(kShortClickThresholdMs))
451 return true; 450 return true;
452 451
453 Panel::ExpansionState new_expansion_state = 452 Panel::ExpansionState new_expansion_state =
454 (panel_->expansion_state() != Panel::EXPANDED) ? Panel::EXPANDED 453 (panel_->expansion_state() != Panel::EXPANDED) ? Panel::EXPANDED
455 : Panel::MINIMIZED; 454 : Panel::MINIMIZED;
456 panel_->SetExpansionState(new_expansion_state); 455 panel_->SetExpansionState(new_expansion_state);
457 return true; 456 return true;
458 } 457 }
459 458
460 bool PanelBrowserView::OnTitlebarMouseCaptureLost() { 459 bool PanelBrowserView::OnTitlebarMouseCaptureLost() {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 555 }
557 556
558 bool NativePanelTestingWin::IsWindowSizeKnown() const { 557 bool NativePanelTestingWin::IsWindowSizeKnown() const {
559 return true; 558 return true;
560 } 559 }
561 560
562 bool NativePanelTestingWin::IsAnimatingBounds() const { 561 bool NativePanelTestingWin::IsAnimatingBounds() const {
563 return panel_browser_view_->bounds_animator_.get() && 562 return panel_browser_view_->bounds_animator_.get() &&
564 panel_browser_view_->bounds_animator_->is_animating(); 563 panel_browser_view_->bounds_animator_->is_animating();
565 } 564 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/panels/panel_browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698