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/panels/panel_browser_window_gtk.h" | 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/ui/browser_list.h" | 8 #include "chrome/browser/ui/browser_list.h" |
9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // RGB values for titlebar in draw attention state. A shade of orange. | 23 // RGB values for titlebar in draw attention state. A shade of orange. |
24 const int kDrawAttentionR = 0xfa; | 24 const int kDrawAttentionR = 0xfa; |
25 const int kDrawAttentionG = 0x98; | 25 const int kDrawAttentionG = 0x98; |
26 const int kDrawAttentionB = 0x3a; | 26 const int kDrawAttentionB = 0x3a; |
27 const float kDrawAttentionRFraction = kDrawAttentionR / 255.0; | 27 const float kDrawAttentionRFraction = kDrawAttentionR / 255.0; |
28 const float kDrawAttentionGFraction = kDrawAttentionG / 255.0; | 28 const float kDrawAttentionGFraction = kDrawAttentionG / 255.0; |
29 const float kDrawAttentionBFraction = kDrawAttentionB / 255.0; | 29 const float kDrawAttentionBFraction = kDrawAttentionB / 255.0; |
30 | 30 |
31 // Delay before click on a titlebar is allowed to minimize the panel after | 31 // Delay before click on a titlebar is allowed to minimize the panel after |
32 // the 'draw attention' mode has been cleared. | 32 // the 'draw attention' mode has been cleared. |
33 const base::TimeDelta kSuspendMinimizeOnClickIntervalMs = | 33 const int kSuspendMinimizeOnClickIntervalMs = 500; |
34 base::TimeDelta::FromMilliseconds(500); | |
35 | 34 |
36 // Markup for title text in draw attention state. Set to color white. | 35 // Markup for title text in draw attention state. Set to color white. |
37 const char* const kDrawAttentionTitleMarkupPrefix = | 36 const char* const kDrawAttentionTitleMarkupPrefix = |
38 "<span fgcolor='#ffffff'>"; | 37 "<span fgcolor='#ffffff'>"; |
39 const char* const kDrawAttentionTitleMarkupSuffix = "</span>"; | 38 const char* const kDrawAttentionTitleMarkupSuffix = "</span>"; |
40 | 39 |
41 } | 40 } |
42 | 41 |
43 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel, | 42 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel, |
44 const gfx::Rect& bounds) { | 43 const gfx::Rect& bounds) { |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 GdkEventFocus* event) { | 579 GdkEventFocus* event) { |
581 BrowserWindowGtk::HandleFocusIn(widget, event); | 580 BrowserWindowGtk::HandleFocusIn(widget, event); |
582 | 581 |
583 if (!is_drawing_attention_) | 582 if (!is_drawing_attention_) |
584 return; | 583 return; |
585 | 584 |
586 is_drawing_attention_ = false; | 585 is_drawing_attention_ = false; |
587 UpdateTitleBar(); | 586 UpdateTitleBar(); |
588 DCHECK(panel_->expansion_state() == Panel::EXPANDED); | 587 DCHECK(panel_->expansion_state() == Panel::EXPANDED); |
589 | 588 |
590 disableMinimizeUntilTime_ = | 589 disableMinimizeUntilTime_ = base::Time::Now() + |
591 base::Time::Now() + kSuspendMinimizeOnClickIntervalMs; | 590 base::TimeDelta::FromMilliseconds(kSuspendMinimizeOnClickIntervalMs); |
592 } | 591 } |
593 | 592 |
594 void PanelBrowserWindowGtk::OnDragBegin(GtkWidget* widget, | 593 void PanelBrowserWindowGtk::OnDragBegin(GtkWidget* widget, |
595 GdkDragContext* context) { | 594 GdkDragContext* context) { |
596 // Set drag icon to be a transparent pixbuf. | 595 // Set drag icon to be a transparent pixbuf. |
597 GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 1, 1); | 596 GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 1, 1); |
598 gdk_pixbuf_fill(pixbuf, 0); | 597 gdk_pixbuf_fill(pixbuf, 0); |
599 gtk_drag_set_icon_pixbuf(context, pixbuf, 0, 0); | 598 gtk_drag_set_icon_pixbuf(context, pixbuf, 0, 0); |
600 g_object_unref(pixbuf); | 599 g_object_unref(pixbuf); |
601 } | 600 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 } | 734 } |
736 } | 735 } |
737 | 736 |
738 bool NativePanelTestingGtk::IsWindowSizeKnown() const { | 737 bool NativePanelTestingGtk::IsWindowSizeKnown() const { |
739 return panel_browser_window_gtk_->window_size_known_; | 738 return panel_browser_window_gtk_->window_size_known_; |
740 } | 739 } |
741 | 740 |
742 bool NativePanelTestingGtk::IsAnimatingBounds() const { | 741 bool NativePanelTestingGtk::IsAnimatingBounds() const { |
743 return panel_browser_window_gtk_->IsAnimatingBounds(); | 742 return panel_browser_window_gtk_->IsAnimatingBounds(); |
744 } | 743 } |
OLD | NEW |