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/views/bubble/bubble.h" | 5 #include "chrome/browser/ui/views/bubble/bubble.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chrome/browser/ui/views/bubble/border_contents.h" | 9 #include "chrome/browser/ui/views/bubble/border_contents.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 void Bubble::OnActivate(UINT action, BOOL minimized, HWND window) { | 365 void Bubble::OnActivate(UINT action, BOOL minimized, HWND window) { |
366 // The popup should close when it is deactivated. | 366 // The popup should close when it is deactivated. |
367 if (action == WA_INACTIVE) { | 367 if (action == WA_INACTIVE) { |
368 if (close_on_deactivate_) | 368 if (close_on_deactivate_) |
369 GetWidget()->Close(); | 369 GetWidget()->Close(); |
370 } else if (action == WA_ACTIVE) { | 370 } else if (action == WA_ACTIVE) { |
371 DCHECK(GetWidget()->GetRootView()->has_children()); | 371 DCHECK(GetWidget()->GetRootView()->has_children()); |
372 GetWidget()->GetRootView()->child_at(0)->RequestFocus(); | 372 GetWidget()->GetRootView()->child_at(0)->RequestFocus(); |
373 } | 373 } |
374 } | 374 } |
375 #elif defined(TOUCH_UI) | |
376 void Bubble::Deactivate() { | |
377 GetWidget()->Close(); | |
378 } | |
379 #elif defined(TOOLKIT_USES_GTK) | 375 #elif defined(TOOLKIT_USES_GTK) |
380 void Bubble::OnActiveChanged() { | 376 void Bubble::OnActiveChanged() { |
381 if (!GetWidget()->IsActive()) | 377 if (!GetWidget()->IsActive()) |
382 GetWidget()->Close(); | 378 GetWidget()->Close(); |
383 } | 379 } |
384 #endif | 380 #endif |
385 | 381 |
386 void Bubble::DoClose(bool closed_by_escape) { | 382 void Bubble::DoClose(bool closed_by_escape) { |
387 if (show_status_ == kClosed) | 383 if (show_status_ == kClosed) |
388 return; | 384 return; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 animation_->Hide(); | 433 animation_->Hide(); |
438 } | 434 } |
439 | 435 |
440 bool Bubble::AcceleratorPressed(const ui::Accelerator& accelerator) { | 436 bool Bubble::AcceleratorPressed(const ui::Accelerator& accelerator) { |
441 if (!delegate_ || delegate_->CloseOnEscape()) { | 437 if (!delegate_ || delegate_->CloseOnEscape()) { |
442 DoClose(true); | 438 DoClose(true); |
443 return true; | 439 return true; |
444 } | 440 } |
445 return false; | 441 return false; |
446 } | 442 } |
OLD | NEW |