OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/external_tab_container.h" | 5 #include "chrome/browser/external_tab_container.h" |
6 | 6 |
7 #include "app/win_util.h" | 7 #include "app/win_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #include "chrome/browser/automation/automation_provider.h" | 10 #include "chrome/browser/automation/automation_provider.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (tab_contents_) { | 123 if (tab_contents_) { |
124 static_cast<TabContents*>(tab_contents_)->Focus(); | 124 static_cast<TabContents*>(tab_contents_)->Focus(); |
125 static_cast<TabContents*>(tab_contents_)->SetInitialFocus(reverse); | 125 static_cast<TabContents*>(tab_contents_)->SetInitialFocus(reverse); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 // static | 129 // static |
130 bool ExternalTabContainer::IsExternalTabContainer(HWND window) { | 130 bool ExternalTabContainer::IsExternalTabContainer(HWND window) { |
131 if (GetProp(window, kWindowObjectKey) != NULL) | 131 if (GetProp(window, kWindowObjectKey) != NULL) |
132 return true; | 132 return true; |
133 | 133 |
134 return false; | 134 return false; |
135 } | 135 } |
136 | 136 |
137 // static | 137 // static |
138 ExternalTabContainer* ExternalTabContainer::GetContainerForTab( | 138 ExternalTabContainer* ExternalTabContainer::GetContainerForTab( |
139 HWND tab_window) { | 139 HWND tab_window) { |
140 HWND parent_window = ::GetParent(tab_window); | 140 HWND parent_window = ::GetParent(tab_window); |
141 if (!::IsWindow(parent_window)) { | 141 if (!::IsWindow(parent_window)) { |
142 return NULL; | 142 return NULL; |
143 } | 143 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 automation_->Send(new AutomationMsg_NavigationStateChanged(0, tab_handle_, | 179 automation_->Send(new AutomationMsg_NavigationStateChanged(0, tab_handle_, |
180 changed_flags)); | 180 changed_flags)); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 void ExternalTabContainer::AddNewContents(TabContents* source, | 184 void ExternalTabContainer::AddNewContents(TabContents* source, |
185 TabContents* new_contents, | 185 TabContents* new_contents, |
186 WindowOpenDisposition disposition, | 186 WindowOpenDisposition disposition, |
187 const gfx::Rect& initial_pos, | 187 const gfx::Rect& initial_pos, |
188 bool user_gesture) { | 188 bool user_gesture) { |
189 if (disposition == NEW_POPUP || disposition == NEW_WINDOW) { | 189 if (disposition == NEW_POPUP || disposition == NEW_WINDOW || |
| 190 disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) { |
190 Browser::BuildPopupWindowHelper(source, new_contents, initial_pos, | 191 Browser::BuildPopupWindowHelper(source, new_contents, initial_pos, |
191 Browser::TYPE_POPUP, | 192 Browser::TYPE_POPUP, |
192 tab_contents_->profile(), true); | 193 tab_contents_->profile(), true); |
193 } else { | 194 } else { |
194 NOTREACHED(); | 195 NOTREACHED(); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 void ExternalTabContainer::ActivateContents(TabContents* contents) { | 199 void ExternalTabContainer::ActivateContents(TabContents* contents) { |
199 } | 200 } |
(...skipping 28 matching lines...) Expand all Loading... |
228 void ExternalTabContainer::ContentsZoomChange(bool zoom_in) { | 229 void ExternalTabContainer::ContentsZoomChange(bool zoom_in) { |
229 } | 230 } |
230 | 231 |
231 void ExternalTabContainer::ToolbarSizeChanged(TabContents* source, | 232 void ExternalTabContainer::ToolbarSizeChanged(TabContents* source, |
232 bool finished) { | 233 bool finished) { |
233 } | 234 } |
234 | 235 |
235 void ExternalTabContainer::ForwardMessageToExternalHost( | 236 void ExternalTabContainer::ForwardMessageToExternalHost( |
236 const std::string& message, const std::string& origin, | 237 const std::string& message, const std::string& origin, |
237 const std::string& target) { | 238 const std::string& target) { |
238 if(automation_) { | 239 if (automation_) { |
239 automation_->Send( | 240 automation_->Send( |
240 new AutomationMsg_ForwardMessageToExternalHost(0, tab_handle_, | 241 new AutomationMsg_ForwardMessageToExternalHost(0, tab_handle_, |
241 message, origin, target)); | 242 message, origin, target)); |
242 } | 243 } |
243 } | 244 } |
244 | 245 |
245 ExtensionFunctionDispatcher* ExternalTabContainer:: | 246 ExtensionFunctionDispatcher* ExternalTabContainer:: |
246 CreateExtensionFunctionDispatcher(RenderViewHost* render_view_host, | 247 CreateExtensionFunctionDispatcher(RenderViewHost* render_view_host, |
247 const std::string& extension_id) { | 248 const std::string& extension_id) { |
248 return new ExtensionFunctionDispatcher(render_view_host, NULL, extension_id); | 249 return new ExtensionFunctionDispatcher(render_view_host, NULL, extension_id); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 NotificationService::current()->Notify( | 390 NotificationService::current()->Notify( |
390 NotificationType::EXTERNAL_TAB_CLOSED, | 391 NotificationType::EXTERNAL_TAB_CLOSED, |
391 Source<NavigationController>(&tab_contents_->controller()), | 392 Source<NavigationController>(&tab_contents_->controller()), |
392 Details<ExternalTabContainer>(this)); | 393 Details<ExternalTabContainer>(this)); |
393 | 394 |
394 delete tab_contents_; | 395 delete tab_contents_; |
395 tab_contents_ = NULL; | 396 tab_contents_ = NULL; |
396 } | 397 } |
397 } | 398 } |
398 | 399 |
OLD | NEW |