OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 if (contents) { | 577 if (contents) { |
578 TabStripModel* target_tab_strip = new_window->tabstrip_model(); | 578 TabStripModel* target_tab_strip = new_window->tabstrip_model(); |
579 target_tab_strip->InsertTabContentsAt(urls.size(), contents, | 579 target_tab_strip->InsertTabContentsAt(urls.size(), contents, |
580 TabStripModel::ADD_NONE); | 580 TabStripModel::ADD_NONE); |
581 } else if (urls.empty()) { | 581 } else if (urls.empty()) { |
582 new_window->NewTab(); | 582 new_window->NewTab(); |
583 } | 583 } |
584 new_window->SelectNumberedTab(0); | 584 new_window->SelectNumberedTab(0); |
585 | 585 |
586 if (focused) | 586 if (focused) |
587 new_window->window()->Show(); | 587 new_window->window()->Show(BrowserWindow::SHOW_CONTEXT_NORMAL); |
588 else | 588 else |
589 new_window->window()->ShowInactive(); | 589 new_window->window()->ShowInactive(); |
590 | 590 |
591 if (new_window->profile()->IsOffTheRecord() && !include_incognito()) { | 591 if (new_window->profile()->IsOffTheRecord() && !include_incognito()) { |
592 // Don't expose incognito windows if the extension isn't allowed. | 592 // Don't expose incognito windows if the extension isn't allowed. |
593 result_.reset(Value::CreateNullValue()); | 593 result_.reset(Value::CreateNullValue()); |
594 } else { | 594 } else { |
595 result_.reset(ExtensionTabUtil::CreateWindowValue(new_window, true)); | 595 result_.reset(ExtensionTabUtil::CreateWindowValue(new_window, true)); |
596 } | 596 } |
597 | 597 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 804 |
805 // We can't load extension URLs into incognito windows unless the extension | 805 // We can't load extension URLs into incognito windows unless the extension |
806 // uses split mode. Special case to fall back to a tabbed window. | 806 // uses split mode. Special case to fall back to a tabbed window. |
807 if (url.SchemeIs(chrome::kExtensionScheme) && | 807 if (url.SchemeIs(chrome::kExtensionScheme) && |
808 !GetExtension()->incognito_split_mode() && | 808 !GetExtension()->incognito_split_mode() && |
809 browser->profile()->IsOffTheRecord()) { | 809 browser->profile()->IsOffTheRecord()) { |
810 Profile* profile = browser->profile()->GetOriginalProfile(); | 810 Profile* profile = browser->profile()->GetOriginalProfile(); |
811 browser = BrowserList::FindTabbedBrowser(profile, false); | 811 browser = BrowserList::FindTabbedBrowser(profile, false); |
812 if (!browser) { | 812 if (!browser) { |
813 browser = Browser::Create(profile); | 813 browser = Browser::Create(profile); |
814 browser->window()->Show(); | 814 browser->window()->Show(BrowserWindow::SHOW_CONTEXT_NORMAL); |
815 } | 815 } |
816 } | 816 } |
817 | 817 |
818 // If index is specified, honor the value, but keep it bound to | 818 // If index is specified, honor the value, but keep it bound to |
819 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior. | 819 // -1 <= index <= tab_strip->count() where -1 invokes the default behavior. |
820 int index = -1; | 820 int index = -1; |
821 if (args->HasKey(keys::kIndexKey)) | 821 if (args->HasKey(keys::kIndexKey)) |
822 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index)); | 822 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index)); |
823 | 823 |
824 TabStripModel* tab_strip = browser->tabstrip_model(); | 824 TabStripModel* tab_strip = browser->tabstrip_model(); |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 // called for every API call the extension made. | 1376 // called for every API call the extension made. |
1377 GotLanguage(language); | 1377 GotLanguage(language); |
1378 } | 1378 } |
1379 | 1379 |
1380 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1380 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1381 result_.reset(Value::CreateStringValue(language.c_str())); | 1381 result_.reset(Value::CreateStringValue(language.c_str())); |
1382 SendResponse(true); | 1382 SendResponse(true); |
1383 | 1383 |
1384 Release(); // Balanced in Run() | 1384 Release(); // Balanced in Run() |
1385 } | 1385 } |
OLD | NEW |