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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void ExternalTabContainer::SetInitialFocus(bool reverse) { | 117 void ExternalTabContainer::SetInitialFocus(bool reverse) { |
118 DCHECK(tab_contents_); | 118 DCHECK(tab_contents_); |
119 if (tab_contents_) { | 119 if (tab_contents_) { |
120 static_cast<TabContents*>(tab_contents_)->Focus(); | 120 static_cast<TabContents*>(tab_contents_)->Focus(); |
121 static_cast<TabContents*>(tab_contents_)->SetInitialFocus(reverse); | 121 static_cast<TabContents*>(tab_contents_)->SetInitialFocus(reverse); |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 // static | 125 // static |
126 bool ExternalTabContainer::IsExternalTabContainer(HWND window) { | 126 bool ExternalTabContainer::IsExternalTabContainer(HWND window) { |
127 std::wstring class_name = win_util::GetClassName(window); | 127 if (GetProp(window, kWindowObjectKey) != NULL) |
128 return _wcsicmp(class_name.c_str(), chrome::kExternalTabWindowClass) == 0; | 128 return true; |
| 129 |
| 130 return false; |
129 } | 131 } |
130 | 132 |
131 // static | 133 // static |
132 ExternalTabContainer* ExternalTabContainer::GetContainerForTab( | 134 ExternalTabContainer* ExternalTabContainer::GetContainerForTab( |
133 HWND tab_window) { | 135 HWND tab_window) { |
134 HWND parent_window = ::GetParent(tab_window); | 136 HWND parent_window = ::GetParent(tab_window); |
135 if (!::IsWindow(parent_window)) { | 137 if (!::IsWindow(parent_window)) { |
136 return NULL; | 138 return NULL; |
137 } | 139 } |
138 if (!IsExternalTabContainer(parent_window)) { | 140 if (!IsExternalTabContainer(parent_window)) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 NotificationService::current()->Notify( | 385 NotificationService::current()->Notify( |
384 NotificationType::EXTERNAL_TAB_CLOSED, | 386 NotificationType::EXTERNAL_TAB_CLOSED, |
385 Source<NavigationController>(&tab_contents_->controller()), | 387 Source<NavigationController>(&tab_contents_->controller()), |
386 Details<ExternalTabContainer>(this)); | 388 Details<ExternalTabContainer>(this)); |
387 | 389 |
388 delete tab_contents_; | 390 delete tab_contents_; |
389 tab_contents_ = NULL; | 391 tab_contents_ = NULL; |
390 } | 392 } |
391 } | 393 } |
392 | 394 |
OLD | NEW |