OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bookmarks/bookmark_prompt_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" | 7 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" |
8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // static | 24 // static |
25 BookmarkPromptView* BookmarkPromptView::bookmark_bubble_ = NULL; | 25 BookmarkPromptView* BookmarkPromptView::bookmark_bubble_ = NULL; |
26 | 26 |
27 // static | 27 // static |
28 void BookmarkPromptView::ShowPrompt(views::View* anchor_view, | 28 void BookmarkPromptView::ShowPrompt(views::View* anchor_view, |
29 PrefService* prefs) { | 29 PrefService* prefs) { |
30 if (bookmark_bubble_) | 30 if (bookmark_bubble_) |
31 return; | 31 return; |
32 bookmark_bubble_ = new BookmarkPromptView(anchor_view, prefs); | 32 bookmark_bubble_ = new BookmarkPromptView(anchor_view, prefs); |
33 views::BubbleDelegateView::CreateBubble(bookmark_bubble_); | 33 views::BubbleDelegateView::CreateBubble(bookmark_bubble_)->Show(); |
34 bookmark_bubble_->Show(); | |
35 } | 34 } |
36 | 35 |
37 BookmarkPromptView::BookmarkPromptView(views::View* anchor_view, | 36 BookmarkPromptView::BookmarkPromptView(views::View* anchor_view, |
38 PrefService* prefs) | 37 PrefService* prefs) |
39 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 38 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
40 dismiss_link_(NULL), | 39 dismiss_link_(NULL), |
41 prefs_(prefs) { | 40 prefs_(prefs) { |
42 // Compensate for built-in vertical padding in the anchor view's image. | 41 // Compensate for built-in vertical padding in the anchor view's image. |
43 set_anchor_insets(gfx::Insets(5, 0, 5, 0)); | 42 set_anchor_insets(gfx::Insets(5, 0, 5, 0)); |
44 } | 43 } |
(...skipping 23 matching lines...) Expand all Loading... |
68 void BookmarkPromptView::LinkClicked(views::Link* source, int event_flags) { | 67 void BookmarkPromptView::LinkClicked(views::Link* source, int event_flags) { |
69 DCHECK_EQ(source, dismiss_link_); | 68 DCHECK_EQ(source, dismiss_link_); |
70 BookmarkPromptController::DisableBookmarkPrompt(prefs_); | 69 BookmarkPromptController::DisableBookmarkPrompt(prefs_); |
71 StartFade(false); | 70 StartFade(false); |
72 } | 71 } |
73 | 72 |
74 void BookmarkPromptView::WindowClosing() { | 73 void BookmarkPromptView::WindowClosing() { |
75 bookmark_bubble_ = NULL; | 74 bookmark_bubble_ = NULL; |
76 BookmarkPromptController::ClosingBookmarkPrompt(); | 75 BookmarkPromptController::ClosingBookmarkPrompt(); |
77 } | 76 } |
OLD | NEW |