| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/pdf/pdf_tab_observer.h" | 5 #include "chrome/browser/ui/pdf/pdf_tab_observer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h" | 7 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h" |
| 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 | 10 |
| 11 PDFTabObserver::PDFTabObserver(TabContentsWrapper* wrapper) | 11 PDFTabObserver::PDFTabObserver(TabContents* tab_contents) |
| 12 : content::WebContentsObserver(wrapper->web_contents()), | 12 : content::WebContentsObserver(tab_contents->web_contents()), |
| 13 wrapper_(wrapper) { | 13 tab_contents_(tab_contents) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 PDFTabObserver::~PDFTabObserver() { | 16 PDFTabObserver::~PDFTabObserver() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
| 20 // WebContentsObserver overrides | 20 // WebContentsObserver overrides |
| 21 | 21 |
| 22 bool PDFTabObserver::OnMessageReceived(const IPC::Message& message) { | 22 bool PDFTabObserver::OnMessageReceived(const IPC::Message& message) { |
| 23 bool handled = true; | 23 bool handled = true; |
| 24 IPC_BEGIN_MESSAGE_MAP(PDFTabObserver, message) | 24 IPC_BEGIN_MESSAGE_MAP(PDFTabObserver, message) |
| 25 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFHasUnsupportedFeature, | 25 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFHasUnsupportedFeature, |
| 26 OnPDFHasUnsupportedFeature) | 26 OnPDFHasUnsupportedFeature) |
| 27 IPC_MESSAGE_UNHANDLED(handled = false) | 27 IPC_MESSAGE_UNHANDLED(handled = false) |
| 28 IPC_END_MESSAGE_MAP() | 28 IPC_END_MESSAGE_MAP() |
| 29 return handled; | 29 return handled; |
| 30 } | 30 } |
| 31 | 31 |
| 32 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
| 33 // Internal helpers | 33 // Internal helpers |
| 34 | 34 |
| 35 void PDFTabObserver::OnPDFHasUnsupportedFeature() { | 35 void PDFTabObserver::OnPDFHasUnsupportedFeature() { |
| 36 PDFHasUnsupportedFeature(wrapper_); | 36 PDFHasUnsupportedFeature(tab_contents_); |
| 37 } | 37 } |
| OLD | NEW |