| 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 #ifndef CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_ | 5 #ifndef CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_ |
| 6 #define CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_ | 6 #define CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "content/browser/tab_contents/tab_contents_observer.h" | 11 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/common/intents_messages.h" | 13 #include "content/common/intents_messages.h" |
| 14 | 14 |
| 15 class RenderViewHost; | 15 class RenderViewHost; |
| 16 class TabContents; | 16 class TabContents; |
| 17 | 17 |
| 18 namespace webkit_glue { | 18 namespace webkit_glue { |
| 19 struct WebIntentData; | 19 struct WebIntentData; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace IPC { | 22 namespace IPC { |
| 23 class Message; | 23 class Message; |
| 24 } | 24 } |
| 25 | 25 |
| 26 // Injects an intent into the renderer of a TabContents. The intent dispatch | 26 // Injects an intent into the renderer of a TabContents. The intent dispatch |
| 27 // logic will create one of these to take care of passing intent data down into | 27 // logic will create one of these to take care of passing intent data down into |
| 28 // the context of the service, which will be running in the TabContents on which | 28 // the context of the service, which will be running in the TabContents on which |
| 29 // this class is an observer. Deletes itself when the tab is closed. | 29 // this class is an observer. Attaches to the service tab and deletes itself |
| 30 // when that TabContents is closed. |
| 30 class CONTENT_EXPORT IntentInjector : public TabContentsObserver { | 31 class CONTENT_EXPORT IntentInjector : public TabContentsObserver { |
| 31 public: | 32 public: |
| 32 // |tab_contents| must not be NULL. | 33 // |tab_contents| must not be NULL. |
| 33 explicit IntentInjector(TabContents* tab_contents); | 34 explicit IntentInjector(TabContents* tab_contents); |
| 34 virtual ~IntentInjector(); | 35 virtual ~IntentInjector(); |
| 35 | 36 |
| 36 // TabContentsObserver implementation. | 37 // TabContentsObserver implementation. |
| 37 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; | 38 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; |
| 38 virtual void DidNavigateMainFramePostCommit( | 39 virtual void DidNavigateMainFramePostCommit( |
| 39 const content::LoadCommittedDetails& details, | 40 const content::LoadCommittedDetails& details, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Message forwarder to the tab invoking the intent. | 72 // Message forwarder to the tab invoking the intent. |
| 72 scoped_ptr<IPC::Message::Sender> source_tab_; | 73 scoped_ptr<IPC::Message::Sender> source_tab_; |
| 73 | 74 |
| 74 // Unique ID assigned to the intent by the source tab. | 75 // Unique ID assigned to the intent by the source tab. |
| 75 int intent_id_; | 76 int intent_id_; |
| 76 | 77 |
| 77 DISALLOW_COPY_AND_ASSIGN(IntentInjector); | 78 DISALLOW_COPY_AND_ASSIGN(IntentInjector); |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 #endif // CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_ | 81 #endif // CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_ |
| OLD | NEW |