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/location_bar/open_pdf_in_reader_view.h" | 5 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/pdf/pdf_tab_helper.h" | 7 #include "chrome/browser/ui/pdf/pdf_tab_helper.h" |
8 #include "chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h" | 8 #include "chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 void OpenPDFInReaderView::ShowBubble() { | 48 void OpenPDFInReaderView::ShowBubble() { |
49 if (bubble_) | 49 if (bubble_) |
50 return; | 50 return; |
51 | 51 |
52 DCHECK(model_); | 52 DCHECK(model_); |
53 bubble_ = new OpenPDFInReaderBubbleView(this, model_); | 53 bubble_ = new OpenPDFInReaderBubbleView(this, model_); |
54 views::BubbleDelegateView::CreateBubble(bubble_); | 54 views::BubbleDelegateView::CreateBubble(bubble_); |
55 bubble_->GetWidget()->AddObserver(this); | 55 bubble_->GetWidget()->AddObserver(this); |
56 bubble_->Show(); | 56 bubble_->GetWidget()->Show(); |
57 } | 57 } |
58 | 58 |
59 void OpenPDFInReaderView::GetAccessibleState(ui::AccessibleViewState* state) { | 59 void OpenPDFInReaderView::GetAccessibleState(ui::AccessibleViewState* state) { |
60 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_OPEN_PDF_IN_READER); | 60 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_OPEN_PDF_IN_READER); |
61 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; | 61 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
62 } | 62 } |
63 | 63 |
64 bool OpenPDFInReaderView::OnMousePressed(const ui::MouseEvent& event) { | 64 bool OpenPDFInReaderView::OnMousePressed(const ui::MouseEvent& event) { |
65 // Show the bubble on mouse release; that is standard button behavior. | 65 // Show the bubble on mouse release; that is standard button behavior. |
66 return true; | 66 return true; |
(...skipping 14 matching lines...) Expand all Loading... |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { | 84 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { |
85 if (!bubble_) | 85 if (!bubble_) |
86 return; | 86 return; |
87 | 87 |
88 bubble_->GetWidget()->RemoveObserver(this); | 88 bubble_->GetWidget()->RemoveObserver(this); |
89 bubble_ = NULL; | 89 bubble_ = NULL; |
90 } | 90 } |
OLD | NEW |