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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 6330010: Prevent extensions from moving tabs between profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 9 years, 11 months 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 | « no previous file | chrome/browser/extensions/extension_tabs_module_constants.h » ('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) 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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 if (!target_browser->IsTabStripEditable()) { 873 if (!target_browser->IsTabStripEditable()) {
874 error_ = keys::kTabStripNotEditableError; 874 error_ = keys::kTabStripNotEditableError;
875 return false; 875 return false;
876 } 876 }
877 877
878 if (target_browser->type() != Browser::TYPE_NORMAL) { 878 if (target_browser->type() != Browser::TYPE_NORMAL) {
879 error_ = keys::kCanOnlyMoveTabsWithinNormalWindowsError; 879 error_ = keys::kCanOnlyMoveTabsWithinNormalWindowsError;
880 return false; 880 return false;
881 } 881 }
882 882
883 if (target_browser->profile() != source_browser->profile()) {
884 error_ = keys::kCanOnlyMoveTabsWithinSameProfileError;
885 return false;
886 }
887
883 // If windowId is different from the current window, move between windows. 888 // If windowId is different from the current window, move between windows.
884 if (ExtensionTabUtil::GetWindowId(target_browser) != 889 if (ExtensionTabUtil::GetWindowId(target_browser) !=
885 ExtensionTabUtil::GetWindowId(source_browser)) { 890 ExtensionTabUtil::GetWindowId(source_browser)) {
886 TabStripModel* target_tab_strip = target_browser->tabstrip_model(); 891 TabStripModel* target_tab_strip = target_browser->tabstrip_model();
887 contents = source_tab_strip->DetachTabContentsAt(tab_index); 892 contents = source_tab_strip->DetachTabContentsAt(tab_index);
888 if (!contents) { 893 if (!contents) {
889 error_ = ExtensionErrorUtils::FormatErrorMessage( 894 error_ = ExtensionErrorUtils::FormatErrorMessage(
890 keys::kTabNotFoundError, base::IntToString(tab_id)); 895 keys::kTabNotFoundError, base::IntToString(tab_id));
891 return false; 896 return false;
892 } 897 }
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 } 1242 }
1238 1243
1239 static GURL ResolvePossiblyRelativeURL(std::string url_string, 1244 static GURL ResolvePossiblyRelativeURL(std::string url_string,
1240 const Extension* extension) { 1245 const Extension* extension) {
1241 GURL url = GURL(url_string); 1246 GURL url = GURL(url_string);
1242 if (!url.is_valid()) 1247 if (!url.is_valid())
1243 url = extension->GetResourceURL(url_string); 1248 url = extension->GetResourceURL(url_string);
1244 1249
1245 return url; 1250 return url;
1246 } 1251 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_module_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698