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

Side by Side Diff: chrome/browser/views/fullscreen_exit_bubble.cc

Issue 43107: Make fullscreen exit bubble link work by preventing the bubble from ever bein... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 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
« no previous file with comments | « chrome/browser/views/fullscreen_exit_bubble.h ('k') | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/fullscreen_exit_bubble.h" 5 #include "chrome/browser/views/fullscreen_exit_bubble.h"
6 6
7 #include "chrome/app/chrome_dll_resource.h" 7 #include "chrome/app/chrome_dll_resource.h"
8 #include "chrome/common/gfx/chrome_canvas.h" 8 #include "chrome/common/gfx/chrome_canvas.h"
9 #include "chrome/common/l10n_util.h" 9 #include "chrome/common/l10n_util.h"
10 #include "chrome/common/l10n_util_win.h" 10 #include "chrome/common/l10n_util_win.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 // Fill it black. 88 // Fill it black.
89 SkPaint paint; 89 SkPaint paint;
90 paint.setStyle(SkPaint::kFill_Style); 90 paint.setStyle(SkPaint::kFill_Style);
91 paint.setFlags(SkPaint::kAntiAlias_Flag); 91 paint.setFlags(SkPaint::kAntiAlias_Flag);
92 paint.setColor(SK_ColorBLACK); 92 paint.setColor(SK_ColorBLACK);
93 canvas->drawPath(path, paint); 93 canvas->drawPath(path, paint);
94 } 94 }
95 95
96 96
97 // FullscreenExitPopup ---------------------------------------------------------
98
99 class FullscreenExitBubble::FullscreenExitPopup : public views::WidgetWin {
100 public:
101 FullscreenExitPopup() : views::WidgetWin() { }
102 virtual ~FullscreenExitPopup() { }
103
104 // views::WidgetWin:
105 virtual LRESULT OnMouseActivate(HWND window,
106 UINT hittest_code,
107 UINT message) {
108 // Prevent the popup from being activated, so it won't steal focus from the
109 // rest of the browser, and doesn't cause problems with the FocusManager's
110 // "RestoreFocusedView()" functionality.
111 return MA_NOACTIVATE;
112 }
113 };
114
115
97 // FullscreenExitBubble -------------------------------------------------------- 116 // FullscreenExitBubble --------------------------------------------------------
98 117
99 const double FullscreenExitBubble::kOpacity = 0.7; 118 const double FullscreenExitBubble::kOpacity = 0.7;
100 const int FullscreenExitBubble::kInitialDelayMs = 2300; 119 const int FullscreenExitBubble::kInitialDelayMs = 2300;
101 const int FullscreenExitBubble::kPositionCheckHz = 10; 120 const int FullscreenExitBubble::kPositionCheckHz = 10;
102 const int FullscreenExitBubble::kSlideInRegionHeightPx = 4; 121 const int FullscreenExitBubble::kSlideInRegionHeightPx = 4;
103 const int FullscreenExitBubble::kSlideInDurationMs = 350; 122 const int FullscreenExitBubble::kSlideInDurationMs = 350;
104 const int FullscreenExitBubble::kSlideOutDurationMs = 700; 123 const int FullscreenExitBubble::kSlideOutDurationMs = 700;
105 124
106 FullscreenExitBubble::FullscreenExitBubble( 125 FullscreenExitBubble::FullscreenExitBubble(
107 views::Widget* frame, 126 views::Widget* frame,
108 CommandUpdater::CommandUpdaterDelegate* delegate) 127 CommandUpdater::CommandUpdaterDelegate* delegate)
109 : root_view_(frame->GetRootView()), 128 : root_view_(frame->GetRootView()),
110 delegate_(delegate), 129 delegate_(delegate),
111 popup_(new views::WidgetWin()), 130 popup_(new FullscreenExitPopup()),
112 size_animation_(new SlideAnimation(this)) { 131 size_animation_(new SlideAnimation(this)) {
113 size_animation_->Reset(1); 132 size_animation_->Reset(1);
114 133
115 // Create the contents view. 134 // Create the contents view.
116 views::Accelerator accelerator(0, false, false, false); 135 views::Accelerator accelerator(0, false, false, false);
117 bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator); 136 bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator);
118 DCHECK(got_accelerator); 137 DCHECK(got_accelerator);
119 view_ = new FullscreenExitView(this, popup_, accelerator.GetShortcutText()); 138 view_ = new FullscreenExitView(this, popup_, accelerator.GetShortcutText());
120 139
121 // Initialize the popup. 140 // Initialize the popup.
122 popup_->set_delete_on_destroy(false); 141 popup_->set_delete_on_destroy(false);
123 popup_->set_window_style(WS_POPUP); 142 popup_->set_window_style(WS_POPUP);
124 popup_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW | 143 popup_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW |
125 l10n_util::GetExtendedTooltipStyles()); 144 l10n_util::GetExtendedTooltipStyles());
126 popup_->SetLayeredAlpha(static_cast<int>(0xff * kOpacity)); 145 popup_->SetLayeredAlpha(static_cast<int>(0xff * kOpacity));
127 popup_->Init(frame->GetHWND(), GetPopupRect(false), false); 146 popup_->Init(frame->GetHWND(), GetPopupRect(false), false);
128 popup_->SetContentsView(view_); 147 popup_->SetContentsView(view_);
129 popup_->Show(); 148 popup_->Show(); // This does not activate the popup.
130 149
131 // Start the initial delay timer. 150 // Start the initial delay timer.
132 initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, 151 initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this,
133 &FullscreenExitBubble::AfterInitialDelay); 152 &FullscreenExitBubble::AfterInitialDelay);
134 } 153 }
135 154
136 FullscreenExitBubble::~FullscreenExitBubble() { 155 FullscreenExitBubble::~FullscreenExitBubble() {
137 // This is tricky. We may be in an ATL message handler stack, in which case 156 // This is tricky. We may be in an ATL message handler stack, in which case
138 // the popup cannot be deleted yet. We also can't blindly use 157 // the popup cannot be deleted yet. We also can't blindly use
139 // set_delete_on_destroy(true) on the popup to delete it when it closes, 158 // set_delete_on_destroy(true) on the popup to delete it when it closes,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 bool ignore_animation_state) const { 230 bool ignore_animation_state) const {
212 gfx::Size size(view_->GetPreferredSize()); 231 gfx::Size size(view_->GetPreferredSize());
213 if (!ignore_animation_state) { 232 if (!ignore_animation_state) {
214 size.set_height(static_cast<int>(static_cast<double>(size.height()) * 233 size.set_height(static_cast<int>(static_cast<double>(size.height()) *
215 size_animation_->GetCurrentValue())); 234 size_animation_->GetCurrentValue()));
216 } 235 }
217 gfx::Point origin((root_view_->width() - size.width()) / 2, 0); 236 gfx::Point origin((root_view_->width() - size.width()) / 2, 0);
218 views::View::ConvertPointToScreen(root_view_, &origin); 237 views::View::ConvertPointToScreen(root_view_, &origin);
219 return gfx::Rect(origin, size); 238 return gfx::Rect(origin, size);
220 } 239 }
OLDNEW
« no previous file with comments | « chrome/browser/views/fullscreen_exit_bubble.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698