OLD | NEW |
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/first_run_bubble.h" | 5 #include "chrome/browser/views/first_run_bubble.h" |
6 | 6 |
7 #include "app/gfx/font_util.h" | 7 #include "app/gfx/font_util.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "app/win_util.h" | 10 #include "app/win_util.h" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 void FirstRunBubble::EnableParent() { | 502 void FirstRunBubble::EnableParent() { |
503 ::EnableWindow(GetParent(), true); | 503 ::EnableWindow(GetParent(), true); |
504 // Reactivate the FirstRunBubble so it responds to OnActivate messages. | 504 // Reactivate the FirstRunBubble so it responds to OnActivate messages. |
505 SetWindowPos(GetParent(), 0, 0, 0, 0, | 505 SetWindowPos(GetParent(), 0, 0, 0, 0, |
506 SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_SHOWWINDOW); | 506 SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_SHOWWINDOW); |
507 } | 507 } |
508 | 508 |
509 void FirstRunBubble::OnActivate(UINT action, BOOL minimized, HWND window) { | 509 void FirstRunBubble::OnActivate(UINT action, BOOL minimized, HWND window) { |
510 // Keep the bubble around for kLingerTime milliseconds, to prevent accidental | 510 // Keep the bubble around for kLingerTime milliseconds, to prevent accidental |
511 // closure. | 511 // closure. |
512 const int kLingerTime = 1000; | 512 const int kLingerTime = 3000; |
513 | 513 |
514 // We might get re-enabled right before we are closed (sequence is: we get | 514 // We might get re-enabled right before we are closed (sequence is: we get |
515 // deactivated, we call close, before we are actually closed we get | 515 // deactivated, we call close, before we are actually closed we get |
516 // reactivated). Don't do the disabling of the parent in such cases. | 516 // reactivated). Don't do the disabling of the parent in such cases. |
517 if (action == WA_ACTIVE && !has_been_activated_) { | 517 if (action == WA_ACTIVE && !has_been_activated_) { |
518 has_been_activated_ = true; | 518 has_been_activated_ = true; |
519 | 519 |
520 ::EnableWindow(GetParent(), false); | 520 ::EnableWindow(GetParent(), false); |
521 | 521 |
522 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 522 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
523 enable_window_method_factory_.NewRunnableMethod( | 523 enable_window_method_factory_.NewRunnableMethod( |
524 &FirstRunBubble::EnableParent), | 524 &FirstRunBubble::EnableParent), |
525 kLingerTime); | 525 kLingerTime); |
| 526 return; |
526 } | 527 } |
527 | 528 |
528 // Keep window from automatically closing until kLingerTime has passed. | 529 // Keep window from automatically closing until kLingerTime has passed. |
529 if (::IsWindowEnabled(GetParent())) | 530 if (::IsWindowEnabled(GetParent())) |
530 InfoBubble::OnActivate(action, minimized, window); | 531 InfoBubble::OnActivate(action, minimized, window); |
531 } | 532 } |
532 | 533 |
533 void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble, | 534 void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble, |
534 bool closed_by_escape) { | 535 bool closed_by_escape) { |
535 // Make sure our parent window is re-enabled. | 536 // Make sure our parent window is re-enabled. |
536 if (!IsWindowEnabled(GetParent())) | 537 if (!IsWindowEnabled(GetParent())) |
537 ::EnableWindow(GetParent(), true); | 538 ::EnableWindow(GetParent(), true); |
538 enable_window_method_factory_.RevokeAll(); | 539 enable_window_method_factory_.RevokeAll(); |
539 GetFocusManager()->RemoveFocusChangeListener(view_); | 540 GetFocusManager()->RemoveFocusChangeListener(view_); |
540 } | 541 } |
OLD | NEW |