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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 use_existing_browser_window = true; | 235 use_existing_browser_window = true; |
236 #endif // OS_WIN | 236 #endif // OS_WIN |
237 | 237 |
238 Browser* new_window = NULL; | 238 Browser* new_window = NULL; |
239 if (use_existing_browser_window) | 239 if (use_existing_browser_window) |
240 // The false parameter passed below is to ensure that we find a browser | 240 // The false parameter passed below is to ensure that we find a browser |
241 // object matching the profile passed in, instead of the original profile | 241 // object matching the profile passed in, instead of the original profile |
242 new_window = browser::FindTabbedBrowser(profile, false); | 242 new_window = browser::FindTabbedBrowser(profile, false); |
243 | 243 |
244 if (!new_window) | 244 if (!new_window) |
245 new_window = Browser::CreateWithParams(params); | 245 new_window = new Browser(params); |
246 return new_window; | 246 return new_window; |
247 } | 247 } |
248 | 248 |
249 } // namespace | 249 } // namespace |
250 | 250 |
251 // Windows --------------------------------------------------------------------- | 251 // Windows --------------------------------------------------------------------- |
252 | 252 |
253 bool GetWindowFunction::RunImpl() { | 253 bool GetWindowFunction::RunImpl() { |
254 scoped_ptr<Get::Params> params(Get::Params::Create(*args_)); | 254 scoped_ptr<Get::Params> params(Get::Params::Create(*args_)); |
255 EXTENSION_FUNCTION_VALIDATE(params.get()); | 255 EXTENSION_FUNCTION_VALIDATE(params.get()); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 SetResult( | 589 SetResult( |
590 panel->extension_window_controller()->CreateWindowValueWithTabs()); | 590 panel->extension_window_controller()->CreateWindowValueWithTabs()); |
591 return true; | 591 return true; |
592 } | 592 } |
593 #endif | 593 #endif |
594 // else fall through to create BrowserWindow | 594 // else fall through to create BrowserWindow |
595 } | 595 } |
596 | 596 |
597 // Create a new BrowserWindow. | 597 // Create a new BrowserWindow. |
598 Browser::CreateParams create_params; | 598 Browser::CreateParams create_params(window_type, window_profile); |
599 if (extension_id.empty()) { | 599 if (extension_id.empty()) { |
600 create_params = Browser::CreateParams(window_type, window_profile); | |
601 create_params.initial_bounds = window_bounds; | 600 create_params.initial_bounds = window_bounds; |
602 } else { | 601 } else { |
603 create_params = Browser::CreateParams::CreateForApp( | 602 create_params = Browser::CreateParams::CreateForApp( |
604 window_type, | 603 window_type, |
605 web_app::GenerateApplicationNameFromExtensionId(extension_id), | 604 web_app::GenerateApplicationNameFromExtensionId(extension_id), |
606 (window_type == Browser::TYPE_PANEL ? panel_bounds : popup_bounds), | 605 (window_type == Browser::TYPE_PANEL ? panel_bounds : popup_bounds), |
607 window_profile); | 606 window_profile); |
608 } | 607 } |
609 create_params.initial_show_state = ui::SHOW_STATE_NORMAL; | 608 create_params.initial_show_state = ui::SHOW_STATE_NORMAL; |
610 | 609 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPinnedKey, &pinned)); | 1035 EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPinnedKey, &pinned)); |
1037 | 1036 |
1038 // We can't load extension URLs into incognito windows unless the extension | 1037 // We can't load extension URLs into incognito windows unless the extension |
1039 // uses split mode. Special case to fall back to a tabbed window. | 1038 // uses split mode. Special case to fall back to a tabbed window. |
1040 if (url.SchemeIs(chrome::kExtensionScheme) && | 1039 if (url.SchemeIs(chrome::kExtensionScheme) && |
1041 !GetExtension()->incognito_split_mode() && | 1040 !GetExtension()->incognito_split_mode() && |
1042 browser->profile()->IsOffTheRecord()) { | 1041 browser->profile()->IsOffTheRecord()) { |
1043 Profile* profile = browser->profile()->GetOriginalProfile(); | 1042 Profile* profile = browser->profile()->GetOriginalProfile(); |
1044 browser = browser::FindTabbedBrowser(profile, false); | 1043 browser = browser::FindTabbedBrowser(profile, false); |
1045 if (!browser) { | 1044 if (!browser) { |
1046 browser = Browser::Create(profile); | 1045 browser = new Browser(Browser::CreateParams(profile)); |
1047 browser->window()->Show(); | 1046 browser->window()->Show(); |
1048 } | 1047 } |
1049 } | 1048 } |
1050 | 1049 |
1051 // If index is specified, honor the value, but keep it bound to | 1050 // If index is specified, honor the value, but keep it bound to |
1052 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior. | 1051 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior. |
1053 int index = -1; | 1052 int index = -1; |
1054 if (args->HasKey(keys::kIndexKey)) | 1053 if (args->HasKey(keys::kIndexKey)) |
1055 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index)); | 1054 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index)); |
1056 | 1055 |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 // called for every API call the extension made. | 1811 // called for every API call the extension made. |
1813 GotLanguage(language); | 1812 GotLanguage(language); |
1814 } | 1813 } |
1815 | 1814 |
1816 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1815 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1817 SetResult(Value::CreateStringValue(language.c_str())); | 1816 SetResult(Value::CreateStringValue(language.c_str())); |
1818 SendResponse(true); | 1817 SendResponse(true); |
1819 | 1818 |
1820 Release(); // Balanced in Run() | 1819 Release(); // Balanced in Run() |
1821 } | 1820 } |
OLD | NEW |