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

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

Issue 2874004: InfoBubble::ShowFocusless() added not to grab the focus when being shown.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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
« no previous file with comments | « chrome/browser/views/info_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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/info_bubble.h" 5 #include "chrome/browser/views/info_bubble.h"
6 6
7 #include "base/keyboard_codes.h" 7 #include "base/keyboard_codes.h"
8 #include "chrome/browser/window_sizer.h" 8 #include "chrome/browser/window_sizer.h"
9 #include "chrome/common/notification_service.h" 9 #include "chrome/common/notification_service.h"
10 #include "gfx/canvas.h" 10 #include "gfx/canvas.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 const gfx::Rect& position_relative_to, 241 const gfx::Rect& position_relative_to,
242 BubbleBorder::ArrowLocation arrow_location, 242 BubbleBorder::ArrowLocation arrow_location,
243 views::View* contents, 243 views::View* contents,
244 InfoBubbleDelegate* delegate) { 244 InfoBubbleDelegate* delegate) {
245 InfoBubble* window = new InfoBubble; 245 InfoBubble* window = new InfoBubble;
246 window->Init(parent, position_relative_to, arrow_location, 246 window->Init(parent, position_relative_to, arrow_location,
247 contents, delegate); 247 contents, delegate);
248 return window; 248 return window;
249 } 249 }
250 250
251 #if defined(OS_CHROMEOS)
252 // static
253 InfoBubble* InfoBubble::ShowFocusless(
254 views::Widget* parent,
255 const gfx::Rect& position_relative_to,
256 BubbleBorder::ArrowLocation arrow_location,
257 views::View* contents,
258 InfoBubbleDelegate* delegate) {
259 InfoBubble* window = new InfoBubble(views::WidgetGtk::TYPE_POPUP);
260 window->Init(parent, position_relative_to, arrow_location,
261 contents, delegate);
262 return window;
263 }
264 #endif
265
251 void InfoBubble::Close() { 266 void InfoBubble::Close() {
252 if (show_status_ != kOpen) 267 if (show_status_ != kOpen)
253 return; 268 return;
254 269
255 show_status_ = kClosing; 270 show_status_ = kClosing;
256 271
257 if (fade_away_on_close_) 272 if (fade_away_on_close_)
258 FadeOut(); 273 FadeOut();
259 else 274 else
260 DoClose(false); 275 DoClose(false);
261 } 276 }
262 277
263 void InfoBubble::AnimationEnded(const Animation* animation) { 278 void InfoBubble::AnimationEnded(const Animation* animation) {
264 if (static_cast<int>(animation_->GetCurrentValue()) == 0) { 279 if (static_cast<int>(animation_->GetCurrentValue()) == 0) {
265 // When fading out we just need to close the bubble at the end 280 // When fading out we just need to close the bubble at the end
266 DoClose(false); 281 DoClose(false);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 #endif 468 #endif
454 SetBounds(window_bounds); 469 SetBounds(window_bounds);
455 } 470 }
456 471
457 #if defined(OS_WIN) 472 #if defined(OS_WIN)
458 void InfoBubble::OnActivate(UINT action, BOOL minimized, HWND window) { 473 void InfoBubble::OnActivate(UINT action, BOOL minimized, HWND window) {
459 // The popup should close when it is deactivated. 474 // The popup should close when it is deactivated.
460 if (action == WA_INACTIVE) { 475 if (action == WA_INACTIVE) {
461 Close(); 476 Close();
462 } else if (action == WA_ACTIVE) { 477 } else if (action == WA_ACTIVE) {
463 DCHECK(GetRootView()->GetChildViewCount() > 0); 478 DCHECK_GT(GetRootView()->GetChildViewCount(), 0);
464 GetRootView()->GetChildViewAt(0)->RequestFocus(); 479 GetRootView()->GetChildViewAt(0)->RequestFocus();
465 } 480 }
466 } 481 }
467 #elif defined(OS_LINUX) 482 #elif defined(OS_LINUX)
468 void InfoBubble::IsActiveChanged() { 483 void InfoBubble::IsActiveChanged() {
469 if (!IsActive()) 484 if (!IsActive())
470 Close(); 485 Close();
471 } 486 }
472 #endif 487 #endif
473 488
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 animation_->Hide(); 533 animation_->Hide();
519 } 534 }
520 535
521 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { 536 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) {
522 if (!delegate_ || delegate_->CloseOnEscape()) { 537 if (!delegate_ || delegate_->CloseOnEscape()) {
523 DoClose(true); 538 DoClose(true);
524 return true; 539 return true;
525 } 540 }
526 return false; 541 return false;
527 } 542 }
OLDNEW
« no previous file with comments | « chrome/browser/views/info_bubble.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698