OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/status_bubble_views.h" | 5 #include "chrome/browser/views/status_bubble_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
12 #include "app/animation.h" | 12 #include "app/animation.h" |
13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "chrome/browser/browser_theme_provider.h" | 16 #include "chrome/browser/browser_theme_provider.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
21 #include "third_party/skia/include/core/SkPaint.h" | 21 #include "third_party/skia/include/core/SkPaint.h" |
22 #include "third_party/skia/include/core/SkPath.h" | 22 #include "third_party/skia/include/core/SkPath.h" |
23 #include "third_party/skia/include/core/SkRect.h" | 23 #include "third_party/skia/include/core/SkRect.h" |
24 #include "views/controls/label.h" | 24 #include "views/controls/label.h" |
25 #include "views/screen.h" | 25 #include "views/screen.h" |
26 #include "views/widget/root_view.h" | 26 #include "views/widget/root_view.h" |
27 #include "views/widget/widget.h" | 27 #include "views/widget/widget.h" |
28 #include "views/window/window.h" | 28 #include "views/window/window.h" |
29 | 29 |
| 30 using views::Widget; |
| 31 |
30 // The alpha and color of the bubble's shadow. | 32 // The alpha and color of the bubble's shadow. |
31 static const SkColor kShadowColor = SkColorSetARGB(30, 0, 0, 0); | 33 static const SkColor kShadowColor = SkColorSetARGB(30, 0, 0, 0); |
32 | 34 |
33 // The roundedness of the edges of our bubble. | 35 // The roundedness of the edges of our bubble. |
34 static const int kBubbleCornerRadius = 4; | 36 static const int kBubbleCornerRadius = 4; |
35 | 37 |
36 // How close the mouse can get to the infobubble before it starts sliding | 38 // How close the mouse can get to the infobubble before it starts sliding |
37 // off-screen. | 39 // off-screen. |
38 static const int kMousePadding = 20; | 40 static const int kMousePadding = 20; |
39 | 41 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 download_shelf_is_visible_(false) { | 457 download_shelf_is_visible_(false) { |
456 } | 458 } |
457 | 459 |
458 StatusBubbleViews::~StatusBubbleViews() { | 460 StatusBubbleViews::~StatusBubbleViews() { |
459 if (popup_.get()) | 461 if (popup_.get()) |
460 popup_->CloseNow(); | 462 popup_->CloseNow(); |
461 } | 463 } |
462 | 464 |
463 void StatusBubbleViews::Init() { | 465 void StatusBubbleViews::Init() { |
464 if (!popup_.get()) { | 466 if (!popup_.get()) { |
465 popup_.reset(views::Widget::CreateTransparentPopupWidget(false)); | 467 popup_.reset(Widget::CreatePopupWidget(Widget::Transparent, |
| 468 Widget::NotAcceptEvents, |
| 469 Widget::NotDeleteOnDestroy)); |
466 if (!view_) | 470 if (!view_) |
467 view_ = new StatusView(this, popup_.get(), frame_->GetThemeProvider()); | 471 view_ = new StatusView(this, popup_.get(), frame_->GetThemeProvider()); |
468 popup_->SetOpacity(0x00); | 472 popup_->SetOpacity(0x00); |
469 popup_->Init(frame_->GetNativeView(), gfx::Rect()); | 473 popup_->Init(frame_->GetNativeView(), gfx::Rect()); |
470 popup_->SetContentsView(view_); | 474 popup_->SetContentsView(view_); |
471 Reposition(); | 475 Reposition(); |
472 popup_->Show(); | 476 popup_->Show(); |
473 } | 477 } |
474 } | 478 } |
475 | 479 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 } | 676 } |
673 } | 677 } |
674 | 678 |
675 bool StatusBubbleViews::IsFrameVisible() { | 679 bool StatusBubbleViews::IsFrameVisible() { |
676 if (!frame_->IsVisible()) | 680 if (!frame_->IsVisible()) |
677 return false; | 681 return false; |
678 | 682 |
679 views::Window* window = frame_->GetWindow(); | 683 views::Window* window = frame_->GetWindow(); |
680 return !window || !window->IsMinimized(); | 684 return !window || !window->IsMinimized(); |
681 } | 685 } |
OLD | NEW |