Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Tab API implementation. | 5 // Tab API implementation. |
| 6 // | 6 // |
| 7 // Tab IDs are the window handle of the "TabWindowClass" window class | 7 // Tab IDs are the window handle of the "TabWindowClass" window class |
| 8 // of the whole tab. | 8 // of the whole tab. |
| 9 // | 9 // |
| 10 // To find the chrome.window.* "window ID" we can just get the top-level parent | 10 // To find the chrome.window.* "window ID" we can just get the top-level parent |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 reinterpret_cast<void**>(executor.Receive())); | 962 reinterpret_cast<void**>(executor.Receive())); |
| 963 if (executor == NULL) { | 963 if (executor == NULL) { |
| 964 LOG(WARNING) << "Failed to get an executor to create a tab."; | 964 LOG(WARNING) << "Failed to get an executor to create a tab."; |
| 965 result->PostError("Internal error while trying to create tab."); | 965 result->PostError("Internal error while trying to create tab."); |
| 966 return; | 966 return; |
| 967 } | 967 } |
| 968 | 968 |
| 969 long flags = selected ? navOpenInNewTab : navOpenInBackgroundTab; | 969 long flags = selected ? navOpenInNewTab : navOpenInBackgroundTab; |
| 970 HRESULT hr = executor->Navigate(base::win::ScopedBstr(url_wstring.c_str()), | 970 HRESULT hr = executor->Navigate(base::win::ScopedBstr(url_wstring.c_str()), |
| 971 flags, base::win::ScopedBstr(L"_blank")); | 971 flags, base::win::ScopedBstr(L"_blank")); |
| 972 // We can DCHECK here because navigating to a new tab shouldn't fail as | |
| 973 // described in the comment at the bottom of CeeeExecutor::Navigate(). | |
| 974 DCHECK(SUCCEEDED(hr)) << "Failed to create tab. " << com::LogHr(hr); | |
| 975 if (FAILED(hr)) { | 972 if (FAILED(hr)) { |
| 973 // Log the error without DCHECKING There are legit reasons for Navigate | |
| 974 // to fail, as explained in comments in CeeeExecutor::Navigate. | |
| 975 // TODO(motek@chromium.org) See why exactly we fail here in some | |
| 976 // integration tests. | |
| 977 LOG(WARNING) << "Failed to create tab. " << com::LogHr(hr); | |
|
mad-corp
2010/12/14 13:38:20
This should be at least ERROR... And I actually th
| |
| 976 result->PostError("Internal error while trying to create tab."); | 978 result->PostError("Internal error while trying to create tab."); |
| 977 return; | 979 return; |
| 978 } | 980 } |
| 979 } | 981 } |
| 980 | 982 |
| 981 // And now we must wait for the new tab to be created before we can respond. | 983 // And now we must wait for the new tab to be created before we can respond. |
| 982 dispatcher->RegisterEphemeralEventHandler( | 984 dispatcher->RegisterEphemeralEventHandler( |
| 983 ext_event_names::kOnTabCreated, | 985 ext_event_names::kOnTabCreated, |
| 984 CreateTab::ContinueExecution, | 986 CreateTab::ContinueExecution, |
| 985 // We don't want to destroy the result in the scoped_ptr when we pass | 987 // We don't want to destroy the result in the scoped_ptr when we pass |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1333 ::SysFreeString(title); | 1335 ::SysFreeString(title); |
| 1334 title = NULL; | 1336 title = NULL; |
| 1335 ::SysFreeString(fav_icon_url); | 1337 ::SysFreeString(fav_icon_url); |
| 1336 fav_icon_url = NULL; | 1338 fav_icon_url = NULL; |
| 1337 | 1339 |
| 1338 status = kCeeeTabStatusLoading; | 1340 status = kCeeeTabStatusLoading; |
| 1339 protected_mode = FALSE; | 1341 protected_mode = FALSE; |
| 1340 } | 1342 } |
| 1341 | 1343 |
| 1342 } // namespace tab_api | 1344 } // namespace tab_api |
| OLD | NEW |