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

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: Remove presubmit check as well. 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
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, chrome::GetActiveDesktop());
242 242
243 if (!new_window) 243 if (!new_window)
244 new_window = new Browser(params); 244 new_window = new Browser(params);
grt (UTC plus 2) 2012/12/03 15:54:39 specify the same host desktop type here as that us
robertshield 2012/12/03 20:25:58 ah, good point. We should definitely audit the "ne
245 return new_window; 245 return new_window;
246 } 246 }
247 247
248 } // namespace 248 } // namespace
249 249
250 // Windows --------------------------------------------------------------------- 250 // Windows ---------------------------------------------------------------------
251 251
252 bool GetWindowFunction::RunImpl() { 252 bool GetWindowFunction::RunImpl() {
253 scoped_ptr<Get::Params> params(Get::Params::Create(*args_)); 253 scoped_ptr<Get::Params> params(Get::Params::Create(*args_));
254 EXTENSION_FUNCTION_VALIDATE(params.get()); 254 EXTENSION_FUNCTION_VALIDATE(params.get());
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 // windowId defaults to "current" window. 988 // windowId defaults to "current" window.
989 int window_id = extension_misc::kCurrentWindowId; 989 int window_id = extension_misc::kCurrentWindowId;
990 if (args->HasKey(keys::kWindowIdKey)) 990 if (args->HasKey(keys::kWindowIdKey))
991 EXTENSION_FUNCTION_VALIDATE(args->GetInteger( 991 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(
992 keys::kWindowIdKey, &window_id)); 992 keys::kWindowIdKey, &window_id));
993 993
994 Browser* browser = NULL; 994 Browser* browser = NULL;
995 if (!GetBrowserFromWindowID(this, window_id, &browser)) 995 if (!GetBrowserFromWindowID(this, window_id, &browser))
996 return false; 996 return false;
997 997
998 // Ensure the selected browser is tabbed. 998 // Ensure the selected browser is tabbed.
grt (UTC plus 2) 2012/12/03 15:54:39 i haven't studied when this is called, but since |
robertshield 2012/12/03 20:25:58 You're right, I had missed that this call site wou
999 if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser()) 999 if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser())
1000 browser = browser::FindTabbedBrowserDeprecated(profile(), 1000 browser = browser::FindTabbedBrowser(profile(), include_incognito(),
1001 include_incognito()); 1001 chrome::GetActiveDesktop());
1002 1002
1003 if (!browser || !browser->window()) 1003 if (!browser || !browser->window())
1004 return false; 1004 return false;
1005 1005
1006 // TODO(jstritar): Add a constant, chrome.tabs.TAB_ID_ACTIVE, that 1006 // TODO(jstritar): Add a constant, chrome.tabs.TAB_ID_ACTIVE, that
1007 // represents the active tab. 1007 // represents the active tab.
1008 WebContents* opener = NULL; 1008 WebContents* opener = NULL;
1009 if (args->HasKey(keys::kOpenerTabIdKey)) { 1009 if (args->HasKey(keys::kOpenerTabIdKey)) {
1010 int opener_id = -1; 1010 int opener_id = -1;
1011 EXTENSION_FUNCTION_VALIDATE(args->GetInteger( 1011 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 bool pinned = false; 1057 bool pinned = false;
1058 if (args->HasKey(keys::kPinnedKey)) 1058 if (args->HasKey(keys::kPinnedKey))
1059 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPinnedKey, &pinned)); 1059 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPinnedKey, &pinned));
1060 1060
1061 // We can't load extension URLs into incognito windows unless the extension 1061 // 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. 1062 // uses split mode. Special case to fall back to a tabbed window.
1063 if (url.SchemeIs(extensions::kExtensionScheme) && 1063 if (url.SchemeIs(extensions::kExtensionScheme) &&
1064 !GetExtension()->incognito_split_mode() && 1064 !GetExtension()->incognito_split_mode() &&
1065 browser->profile()->IsOffTheRecord()) { 1065 browser->profile()->IsOffTheRecord()) {
1066 Profile* profile = browser->profile()->GetOriginalProfile(); 1066 Profile* profile = browser->profile()->GetOriginalProfile();
1067 browser = browser::FindTabbedBrowserDeprecated(profile, false); 1067 browser = browser::FindTabbedBrowser(profile, false,
1068 chrome::GetActiveDesktop());
grt (UTC plus 2) 2012/12/03 15:54:39 along similar lines, why not use the same host des
robertshield 2012/12/03 20:25:58 Done.
1068 if (!browser) { 1069 if (!browser) {
1069 browser = new Browser(Browser::CreateParams(profile)); 1070 browser = new Browser(Browser::CreateParams(profile));
grt (UTC plus 2) 2012/12/03 15:54:39 specify the same host desktop type here as that us
robertshield 2012/12/03 20:25:58 Done.
1070 browser->window()->Show(); 1071 browser->window()->Show();
1071 } 1072 }
1072 } 1073 }
1073 1074
1074 // If index is specified, honor the value, but keep it bound to 1075 // If index is specified, honor the value, but keep it bound to
1075 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior. 1076 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior.
1076 int index = -1; 1077 int index = -1;
1077 if (args->HasKey(keys::kIndexKey)) 1078 if (args->HasKey(keys::kIndexKey))
1078 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index)); 1079 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index));
1079 1080
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 // called for every API call the extension made. 1871 // called for every API call the extension made.
1871 GotLanguage(language); 1872 GotLanguage(language);
1872 } 1873 }
1873 1874
1874 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1875 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1875 SetResult(Value::CreateStringValue(language.c_str())); 1876 SetResult(Value::CreateStringValue(language.c_str()));
1876 SendResponse(true); 1877 SendResponse(true);
1877 1878
1878 Release(); // Balanced in Run() 1879 Release(); // Balanced in Run()
1879 } 1880 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698