Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.cc

Issue 477263003: pdf: Create a separate component for using the pdf pepper plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
8 #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 "components/pdf/browser/open_pdf_in_reader_prompt_delegate.h"
9 #include "components/pdf/browser/pdf_tab_helper.h"
9 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
10 #include "grit/theme_resources.h" 11 #include "grit/theme_resources.h"
11 #include "ui/accessibility/ax_view_state.h" 12 #include "ui/accessibility/ax_view_state.h"
12 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 16
16 OpenPDFInReaderView::OpenPDFInReaderView() : bubble_(NULL), model_(NULL) { 17 OpenPDFInReaderView::OpenPDFInReaderView() : bubble_(NULL), model_(NULL) {
17 SetAccessibilityFocusable(true); 18 SetAccessibilityFocusable(true);
18 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 19 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
19 IDR_OMNIBOX_PDF_ICON)); 20 IDR_OMNIBOX_PDF_ICON));
20 SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK)); 21 SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK));
21 } 22 }
22 23
23 OpenPDFInReaderView::~OpenPDFInReaderView() { 24 OpenPDFInReaderView::~OpenPDFInReaderView() {
24 if (bubble_) 25 if (bubble_)
25 bubble_->GetWidget()->RemoveObserver(this); 26 bubble_->GetWidget()->RemoveObserver(this);
26 } 27 }
27 28
28 void OpenPDFInReaderView::Update(content::WebContents* web_contents) { 29 void OpenPDFInReaderView::Update(content::WebContents* web_contents) {
29 model_ = NULL; 30 model_ = NULL;
30 if (web_contents) { 31 if (web_contents) {
31 PDFTabHelper* pdf_tab_helper = PDFTabHelper::FromWebContents(web_contents); 32 pdf::PDFTabHelper* pdf_tab_helper =
33 pdf::PDFTabHelper::FromWebContents(web_contents);
32 model_ = pdf_tab_helper->open_in_reader_prompt(); 34 model_ = pdf_tab_helper->open_in_reader_prompt();
33 } 35 }
34 36
35 SetVisible(!!model_); 37 SetVisible(!!model_);
36 } 38 }
37 39
38 void OpenPDFInReaderView::ShowBubble() { 40 void OpenPDFInReaderView::ShowBubble() {
39 if (bubble_) 41 if (bubble_)
40 return; 42 return;
41 43
(...skipping 29 matching lines...) Expand all
71 return true; 73 return true;
72 } 74 }
73 75
74 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) { 76 void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) {
75 if (!bubble_) 77 if (!bubble_)
76 return; 78 return;
77 79
78 bubble_->GetWidget()->RemoveObserver(this); 80 bubble_->GetWidget()->RemoveObserver(this);
79 bubble_ = NULL; 81 bubble_ = NULL;
80 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698