Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs.cc

Issue 11348344: Remove last usages of FindTabbedBrowserDeprecated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Dear Greg. Moar context. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « PRESUBMIT.py ('k') | chrome/browser/extensions/extension_install_ui_default.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (base::win::IsMetroProcess()) 232 if (base::win::IsMetroProcess())
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 = browser::FindTabbedBrowser(
241 profile, false, chrome::GetActiveDesktop()); 241 profile, false, 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 if (extension_id.empty()) { 608 if (extension_id.empty()) {
609 create_params.initial_bounds = window_bounds; 609 create_params.initial_bounds = window_bounds;
610 } else { 610 } else {
611 create_params = Browser::CreateParams::CreateForApp( 611 create_params = Browser::CreateParams::CreateForApp(
612 window_type, 612 window_type,
613 web_app::GenerateApplicationNameFromExtensionId(extension_id), 613 web_app::GenerateApplicationNameFromExtensionId(extension_id),
614 window_bounds, 614 window_bounds,
615 window_profile); 615 window_profile);
616 } 616 }
617 create_params.initial_show_state = ui::SHOW_STATE_NORMAL; 617 create_params.initial_show_state = ui::SHOW_STATE_NORMAL;
618 create_params.host_desktop_type = chrome::GetActiveDesktop();
618 619
619 Browser* new_window = CreateBrowserWindow(create_params, window_profile, 620 Browser* new_window = CreateBrowserWindow(create_params, window_profile,
620 extension_id); 621 extension_id);
621 622
622 for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) { 623 for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) {
623 WebContents* tab = chrome::AddSelectedTabWithURL( 624 WebContents* tab = chrome::AddSelectedTabWithURL(
624 new_window, *i, content::PAGE_TRANSITION_LINK); 625 new_window, *i, content::PAGE_TRANSITION_LINK);
625 if (window_type == Browser::TYPE_PANEL) { 626 if (window_type == Browser::TYPE_PANEL) {
626 extensions::TabHelper::FromWebContents(tab)-> 627 extensions::TabHelper::FromWebContents(tab)->
627 SetExtensionAppIconById(extension_id); 628 SetExtensionAppIconById(extension_id);
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 if (args->HasKey(keys::kWindowIdKey)) 991 if (args->HasKey(keys::kWindowIdKey))
991 EXTENSION_FUNCTION_VALIDATE(args->GetInteger( 992 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(
992 keys::kWindowIdKey, &window_id)); 993 keys::kWindowIdKey, &window_id));
993 994
994 Browser* browser = NULL; 995 Browser* browser = NULL;
995 if (!GetBrowserFromWindowID(this, window_id, &browser)) 996 if (!GetBrowserFromWindowID(this, window_id, &browser))
996 return false; 997 return false;
997 998
998 // Ensure the selected browser is tabbed. 999 // Ensure the selected browser is tabbed.
999 if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser()) 1000 if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser())
1000 browser = browser::FindTabbedBrowserDeprecated(profile(), 1001 browser = browser::FindTabbedBrowser(profile(), include_incognito(),
1001 include_incognito()); 1002 browser->host_desktop_type());
1002 1003
1003 if (!browser || !browser->window()) 1004 if (!browser || !browser->window())
1004 return false; 1005 return false;
1005 1006
1006 // TODO(jstritar): Add a constant, chrome.tabs.TAB_ID_ACTIVE, that 1007 // TODO(jstritar): Add a constant, chrome.tabs.TAB_ID_ACTIVE, that
1007 // represents the active tab. 1008 // represents the active tab.
1008 WebContents* opener = NULL; 1009 WebContents* opener = NULL;
1009 if (args->HasKey(keys::kOpenerTabIdKey)) { 1010 if (args->HasKey(keys::kOpenerTabIdKey)) {
1010 int opener_id = -1; 1011 int opener_id = -1;
1011 EXTENSION_FUNCTION_VALIDATE(args->GetInteger( 1012 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 bool pinned = false; 1058 bool pinned = false;
1058 if (args->HasKey(keys::kPinnedKey)) 1059 if (args->HasKey(keys::kPinnedKey))
1059 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPinnedKey, &pinned)); 1060 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPinnedKey, &pinned));
1060 1061
1061 // We can't load extension URLs into incognito windows unless the extension 1062 // We can't load extension URLs into incognito windows unless the extension
1062 // uses split mode. Special case to fall back to a tabbed window. 1063 // uses split mode. Special case to fall back to a tabbed window.
1063 if (url.SchemeIs(extensions::kExtensionScheme) && 1064 if (url.SchemeIs(extensions::kExtensionScheme) &&
1064 !GetExtension()->incognito_split_mode() && 1065 !GetExtension()->incognito_split_mode() &&
1065 browser->profile()->IsOffTheRecord()) { 1066 browser->profile()->IsOffTheRecord()) {
1066 Profile* profile = browser->profile()->GetOriginalProfile(); 1067 Profile* profile = browser->profile()->GetOriginalProfile();
1067 browser = browser::FindTabbedBrowserDeprecated(profile, false); 1068 chrome::HostDesktopType desktop_type = browser->host_desktop_type();
1069
1070 browser = browser::FindTabbedBrowser(profile, false, desktop_type);
1068 if (!browser) { 1071 if (!browser) {
1069 browser = new Browser(Browser::CreateParams(profile)); 1072 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED,
1073 profile, desktop_type));
1070 browser->window()->Show(); 1074 browser->window()->Show();
1071 } 1075 }
1072 } 1076 }
1073 1077
1074 // If index is specified, honor the value, but keep it bound to 1078 // If index is specified, honor the value, but keep it bound to
1075 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior. 1079 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior.
1076 int index = -1; 1080 int index = -1;
1077 if (args->HasKey(keys::kIndexKey)) 1081 if (args->HasKey(keys::kIndexKey))
1078 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index)); 1082 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index));
1079 1083
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 // called for every API call the extension made. 1874 // called for every API call the extension made.
1871 GotLanguage(language); 1875 GotLanguage(language);
1872 } 1876 }
1873 1877
1874 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1878 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1875 SetResult(Value::CreateStringValue(language.c_str())); 1879 SetResult(Value::CreateStringValue(language.c_str()));
1876 SendResponse(true); 1880 SendResponse(true);
1877 1881
1878 Release(); // Balanced in Run() 1882 Release(); // Balanced in Run()
1879 } 1883 }
OLDNEW
« no previous file with comments | « PRESUBMIT.py ('k') | chrome/browser/extensions/extension_install_ui_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698