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/extensions/api/tabs/tabs.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 #if defined(OS_WIN) | 230 #if defined(OS_WIN) |
231 // In windows 8 metro mode we don't allow windows to be created. | 231 // In windows 8 metro mode we don't allow windows to be created. |
232 if (win8::IsSingleWindowMetroMode()) | 232 if (win8::IsSingleWindowMetroMode()) |
233 use_existing_browser_window = true; | 233 use_existing_browser_window = true; |
234 #endif // OS_WIN | 234 #endif // OS_WIN |
235 | 235 |
236 Browser* new_window = NULL; | 236 Browser* new_window = NULL; |
237 if (use_existing_browser_window) | 237 if (use_existing_browser_window) |
238 // The false parameter passed below is to ensure that we find a browser | 238 // The false parameter passed below is to ensure that we find a browser |
239 // object matching the profile passed in, instead of the original profile | 239 // object matching the profile passed in, instead of the original profile |
240 new_window = browser::FindTabbedBrowser( | 240 new_window = chrome::FindTabbedBrowser(profile, false, |
241 profile, false, params.host_desktop_type); | 241 params.host_desktop_type); |
242 | 242 |
243 if (!new_window) | 243 if (!new_window) |
244 new_window = new Browser(params); | 244 new_window = new Browser(params); |
245 return new_window; | 245 return new_window; |
246 } | 246 } |
247 | 247 |
248 } // namespace | 248 } // namespace |
249 | 249 |
250 // Windows --------------------------------------------------------------------- | 250 // Windows --------------------------------------------------------------------- |
251 | 251 |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 if (args->HasKey(keys::kWindowIdKey)) | 992 if (args->HasKey(keys::kWindowIdKey)) |
993 EXTENSION_FUNCTION_VALIDATE(args->GetInteger( | 993 EXTENSION_FUNCTION_VALIDATE(args->GetInteger( |
994 keys::kWindowIdKey, &window_id)); | 994 keys::kWindowIdKey, &window_id)); |
995 | 995 |
996 Browser* browser = NULL; | 996 Browser* browser = NULL; |
997 if (!GetBrowserFromWindowID(this, window_id, &browser)) | 997 if (!GetBrowserFromWindowID(this, window_id, &browser)) |
998 return false; | 998 return false; |
999 | 999 |
1000 // Ensure the selected browser is tabbed. | 1000 // Ensure the selected browser is tabbed. |
1001 if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser()) | 1001 if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser()) |
1002 browser = browser::FindTabbedBrowser(profile(), include_incognito(), | 1002 browser = chrome::FindTabbedBrowser(profile(), include_incognito(), |
1003 browser->host_desktop_type()); | 1003 browser->host_desktop_type()); |
1004 | 1004 |
1005 if (!browser || !browser->window()) | 1005 if (!browser || !browser->window()) |
1006 return false; | 1006 return false; |
1007 | 1007 |
1008 // TODO(jstritar): Add a constant, chrome.tabs.TAB_ID_ACTIVE, that | 1008 // TODO(jstritar): Add a constant, chrome.tabs.TAB_ID_ACTIVE, that |
1009 // represents the active tab. | 1009 // represents the active tab. |
1010 WebContents* opener = NULL; | 1010 WebContents* opener = NULL; |
1011 if (args->HasKey(keys::kOpenerTabIdKey)) { | 1011 if (args->HasKey(keys::kOpenerTabIdKey)) { |
1012 int opener_id = -1; | 1012 int opener_id = -1; |
1013 EXTENSION_FUNCTION_VALIDATE(args->GetInteger( | 1013 EXTENSION_FUNCTION_VALIDATE(args->GetInteger( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPinnedKey, &pinned)); | 1061 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPinnedKey, &pinned)); |
1062 | 1062 |
1063 // We can't load extension URLs into incognito windows unless the extension | 1063 // We can't load extension URLs into incognito windows unless the extension |
1064 // uses split mode. Special case to fall back to a tabbed window. | 1064 // uses split mode. Special case to fall back to a tabbed window. |
1065 if (url.SchemeIs(extensions::kExtensionScheme) && | 1065 if (url.SchemeIs(extensions::kExtensionScheme) && |
1066 !GetExtension()->incognito_split_mode() && | 1066 !GetExtension()->incognito_split_mode() && |
1067 browser->profile()->IsOffTheRecord()) { | 1067 browser->profile()->IsOffTheRecord()) { |
1068 Profile* profile = browser->profile()->GetOriginalProfile(); | 1068 Profile* profile = browser->profile()->GetOriginalProfile(); |
1069 chrome::HostDesktopType desktop_type = browser->host_desktop_type(); | 1069 chrome::HostDesktopType desktop_type = browser->host_desktop_type(); |
1070 | 1070 |
1071 browser = browser::FindTabbedBrowser(profile, false, desktop_type); | 1071 browser = chrome::FindTabbedBrowser(profile, false, desktop_type); |
1072 if (!browser) { | 1072 if (!browser) { |
1073 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED, | 1073 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED, |
1074 profile, desktop_type)); | 1074 profile, desktop_type)); |
1075 browser->window()->Show(); | 1075 browser->window()->Show(); |
1076 } | 1076 } |
1077 } | 1077 } |
1078 | 1078 |
1079 // If index is specified, honor the value, but keep it bound to | 1079 // If index is specified, honor the value, but keep it bound to |
1080 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior. | 1080 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior. |
1081 int index = -1; | 1081 int index = -1; |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 // called for every API call the extension made. | 1877 // called for every API call the extension made. |
1878 GotLanguage(language); | 1878 GotLanguage(language); |
1879 } | 1879 } |
1880 | 1880 |
1881 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1881 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1882 SetResult(Value::CreateStringValue(language.c_str())); | 1882 SetResult(Value::CreateStringValue(language.c_str())); |
1883 SendResponse(true); | 1883 SendResponse(true); |
1884 | 1884 |
1885 Release(); // Balanced in Run() | 1885 Release(); // Balanced in Run() |
1886 } | 1886 } |
OLD | NEW |