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" | |
9 #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" |
10 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
11 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
12 #include "ui/accessibility/ax_view_state.h" | 11 #include "ui/accessibility/ax_view_state.h" |
13 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
16 | 15 |
17 OpenPDFInReaderView::OpenPDFInReaderView() : bubble_(NULL), model_(NULL) { | 16 OpenPDFInReaderView::OpenPDFInReaderView() : bubble_(NULL), model_(NULL) { |
18 SetAccessibilityFocusable(true); | 17 SetAccessibilityFocusable(true); |
19 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 18 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
20 IDR_OMNIBOX_PDF_ICON)); | 19 IDR_OMNIBOX_PDF_ICON)); |
21 SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK)); | 20 SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK)); |
22 LocationBarView::InitTouchableLocationBarChildView(this); | |
23 } | 21 } |
24 | 22 |
25 OpenPDFInReaderView::~OpenPDFInReaderView() { | 23 OpenPDFInReaderView::~OpenPDFInReaderView() { |
26 if (bubble_) | 24 if (bubble_) |
27 bubble_->GetWidget()->RemoveObserver(this); | 25 bubble_->GetWidget()->RemoveObserver(this); |
28 } | 26 } |
29 | 27 |
30 void OpenPDFInReaderView::Update(content::WebContents* web_contents) { | 28 void OpenPDFInReaderView::Update(content::WebContents* web_contents) { |
31 model_ = NULL; | 29 model_ = NULL; |
32 if (web_contents) { | 30 if (web_contents) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return true; | 71 return true; |
74 } | 72 } |
75 | 73 |
76 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { | 74 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { |
77 if (!bubble_) | 75 if (!bubble_) |
78 return; | 76 return; |
79 | 77 |
80 bubble_->GetWidget()->RemoveObserver(this); | 78 bubble_->GetWidget()->RemoveObserver(this); |
81 bubble_ = NULL; | 79 bubble_ = NULL; |
82 } | 80 } |
OLD | NEW |