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/intents/web_intent_inline_disposition_delegate.h" | 5 #include "chrome/browser/ui/intents/web_intent_inline_disposition_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ui/intents/web_intent_picker.h" | 8 #include "chrome/browser/ui/intents/web_intent_picker.h" |
9 #include "chrome/common/extensions/extension_messages.h" | 9 #include "chrome/common/extensions/extension_messages.h" |
10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
| 11 #include "content/public/browser/render_view_host.h" |
11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
12 #include "content/public/common/renderer_preferences.h" | 13 #include "content/public/common/renderer_preferences.h" |
13 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
14 | 15 |
15 WebIntentInlineDispositionDelegate::WebIntentInlineDispositionDelegate( | 16 WebIntentInlineDispositionDelegate::WebIntentInlineDispositionDelegate( |
16 WebIntentPicker* picker, | 17 WebIntentPicker* picker, |
17 content::WebContents* contents, | 18 content::WebContents* contents, |
18 Profile* profile) | 19 Profile* profile) |
19 : picker_(picker), | 20 : picker_(picker), |
20 web_contents_(contents), | 21 web_contents_(contents), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 67 |
67 bool WebIntentInlineDispositionDelegate::OnMessageReceived( | 68 bool WebIntentInlineDispositionDelegate::OnMessageReceived( |
68 const IPC::Message& message) { | 69 const IPC::Message& message) { |
69 bool handled = true; | 70 bool handled = true; |
70 IPC_BEGIN_MESSAGE_MAP(WebIntentInlineDispositionDelegate, message) | 71 IPC_BEGIN_MESSAGE_MAP(WebIntentInlineDispositionDelegate, message) |
71 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) | 72 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) |
72 IPC_MESSAGE_UNHANDLED(handled = false) | 73 IPC_MESSAGE_UNHANDLED(handled = false) |
73 IPC_END_MESSAGE_MAP() | 74 IPC_END_MESSAGE_MAP() |
74 return handled; | 75 return handled; |
75 } | 76 } |
| 77 void WebIntentInlineDispositionDelegate::RenderViewCreated( |
| 78 content::RenderViewHost* render_view_host) { |
| 79 DCHECK(render_view_host); |
| 80 render_view_host->EnableAutoResize( |
| 81 WebIntentPicker::GetMinInlineDispositionSize(), |
| 82 WebIntentPicker::GetMaxInlineDispositionSize()); |
| 83 } |
76 | 84 |
77 content::WebContents* WebIntentInlineDispositionDelegate:: | 85 content::WebContents* WebIntentInlineDispositionDelegate:: |
78 GetAssociatedWebContents() const { | 86 GetAssociatedWebContents() const { |
79 return NULL; | 87 return NULL; |
80 } | 88 } |
81 | 89 |
82 ExtensionWindowController* WebIntentInlineDispositionDelegate:: | 90 ExtensionWindowController* WebIntentInlineDispositionDelegate:: |
83 GetExtensionWindowController() const { | 91 GetExtensionWindowController() const { |
84 return NULL; | 92 return NULL; |
85 } | 93 } |
86 | 94 |
87 void WebIntentInlineDispositionDelegate::OnRequest( | 95 void WebIntentInlineDispositionDelegate::OnRequest( |
88 const ExtensionHostMsg_Request_Params& params) { | 96 const ExtensionHostMsg_Request_Params& params) { |
89 extension_function_dispatcher_.Dispatch(params, | 97 extension_function_dispatcher_.Dispatch(params, |
90 web_contents_->GetRenderViewHost()); | 98 web_contents_->GetRenderViewHost()); |
91 } | 99 } |
| 100 void WebIntentInlineDispositionDelegate::ResizeDueToAutoResize( |
| 101 content::WebContents* source, const gfx::Size& pref_size) { |
| 102 DCHECK(picker_); |
| 103 picker_->OnInlineDispositionAutoResize(pref_size); |
| 104 } |
OLD | NEW |