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/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
9 #include "chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h" | 9 #include "chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h" |
10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
12 #include "ui/base/accessibility/accessible_view_state.h" | 12 #include "ui/base/accessibility/accessible_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(LocationBarView* location_bar_view) | 17 OpenPDFInReaderView::OpenPDFInReaderView(LocationBarView* location_bar_view) |
18 : location_bar_view_(location_bar_view), | 18 : location_bar_view_(location_bar_view), |
19 bubble_(NULL), | 19 bubble_(NULL), |
20 model_(NULL) { | 20 model_(NULL) { |
21 set_accessibility_focusable(true); | 21 SetAccessibilityFocusable(true); |
22 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 22 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
23 IDR_OMNIBOX_PDF_ICON)); | 23 IDR_OMNIBOX_PDF_ICON)); |
24 SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK)); | 24 SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK)); |
25 LocationBarView::InitTouchableLocationBarChildView(this); | 25 LocationBarView::InitTouchableLocationBarChildView(this); |
26 } | 26 } |
27 | 27 |
28 OpenPDFInReaderView::~OpenPDFInReaderView() { | 28 OpenPDFInReaderView::~OpenPDFInReaderView() { |
29 if (bubble_) | 29 if (bubble_) |
30 bubble_->GetWidget()->RemoveObserver(this); | 30 bubble_->GetWidget()->RemoveObserver(this); |
31 } | 31 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return true; | 76 return true; |
77 } | 77 } |
78 | 78 |
79 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { | 79 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { |
80 if (!bubble_) | 80 if (!bubble_) |
81 return; | 81 return; |
82 | 82 |
83 bubble_->GetWidget()->RemoveObserver(this); | 83 bubble_->GetWidget()->RemoveObserver(this); |
84 bubble_ = NULL; | 84 bubble_ = NULL; |
85 } | 85 } |
OLD | NEW |