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/views/open_pdf_in_reader_bubble_view.h" | 7 #include "chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h" |
8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
9 #include "components/pdf/browser/open_pdf_in_reader_prompt_client.h" | 9 #include "components/pdf/browser/open_pdf_in_reader_prompt_client.h" |
10 #include "components/pdf/browser/pdf_web_contents_helper.h" | 10 #include "components/pdf/browser/pdf_web_contents_helper.h" |
11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
12 #include "ui/accessibility/ax_view_state.h" | 12 #include "ui/accessibility/ax_view_state.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 | 16 |
17 OpenPDFInReaderView::OpenPDFInReaderView() : bubble_(NULL), model_(NULL) { | 17 OpenPDFInReaderView::OpenPDFInReaderView() : bubble_(NULL), model_(NULL) { |
18 SetAccessibilityFocusable(true); | 18 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
19 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 19 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
20 IDR_OMNIBOX_PDF_ICON)); | 20 IDR_OMNIBOX_PDF_ICON)); |
21 SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK)); | 21 SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK)); |
22 } | 22 } |
23 | 23 |
24 OpenPDFInReaderView::~OpenPDFInReaderView() { | 24 OpenPDFInReaderView::~OpenPDFInReaderView() { |
25 if (bubble_) | 25 if (bubble_) |
26 bubble_->GetWidget()->RemoveObserver(this); | 26 bubble_->GetWidget()->RemoveObserver(this); |
27 } | 27 } |
28 | 28 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { | 81 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { |
82 if (!bubble_) | 82 if (!bubble_) |
83 return; | 83 return; |
84 | 84 |
85 bubble_->GetWidget()->RemoveObserver(this); | 85 bubble_->GetWidget()->RemoveObserver(this); |
86 bubble_ = NULL; | 86 bubble_ = NULL; |
87 } | 87 } |
OLD | NEW |