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

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

Issue 308003003: Allow requesting Automation tree by tabId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary content script from tests Created 6 years, 6 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
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_api.h" 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // appropriate message if the tab cannot be found by id. 125 // appropriate message if the tab cannot be found by id.
126 bool GetTabById(int tab_id, 126 bool GetTabById(int tab_id,
127 Profile* profile, 127 Profile* profile,
128 bool include_incognito, 128 bool include_incognito,
129 Browser** browser, 129 Browser** browser,
130 TabStripModel** tab_strip, 130 TabStripModel** tab_strip,
131 content::WebContents** contents, 131 content::WebContents** contents,
132 int* tab_index, 132 int* tab_index,
133 std::string* error_message) { 133 std::string* error_message) {
134 if (ExtensionTabUtil::GetTabById(tab_id, profile, include_incognito, 134 if (ExtensionTabUtil::GetTabById(tab_id, profile, include_incognito,
135 browser, tab_strip, contents, tab_index)) 135 browser, tab_strip, contents, tab_index)) {
136 return true; 136 return true;
137 }
137 138
138 if (error_message) 139 if (error_message) {
139 *error_message = ErrorUtils::FormatErrorMessage( 140 *error_message = ErrorUtils::FormatErrorMessage(
140 keys::kTabNotFoundError, base::IntToString(tab_id)); 141 keys::kTabNotFoundError, base::IntToString(tab_id));
142 }
not at google - send to devlin 2014/05/29 22:41:37 ok :)
141 143
142 return false; 144 return false;
143 } 145 }
144 146
145 // Returns true if either |boolean| is a null pointer, or if |*boolean| and 147 // Returns true if either |boolean| is a null pointer, or if |*boolean| and
146 // |value| are equal. This function is used to check if a tab's parameters match 148 // |value| are equal. This function is used to check if a tab's parameters match
147 // those of the browser. 149 // those of the browser.
148 bool MatchesBool(bool* boolean, bool value) { 150 bool MatchesBool(bool* boolean, bool value) {
149 return !boolean || *boolean == value; 151 return !boolean || *boolean == value;
150 } 152 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 error_ = keys::kIncognitoModeIsForced; 278 error_ = keys::kIncognitoModeIsForced;
277 *is_error = true; 279 *is_error = true;
278 return false; 280 return false;
279 } 281 }
280 } else if (incognito_availability == IncognitoModePrefs::FORCED) { 282 } else if (incognito_availability == IncognitoModePrefs::FORCED) {
281 // If incognito argument is not specified explicitly, we default to 283 // If incognito argument is not specified explicitly, we default to
282 // incognito when forced so by policy. 284 // incognito when forced so by policy.
283 incognito = true; 285 incognito = true;
284 } 286 }
285 287
288
not at google - send to devlin 2014/05/29 22:41:37 no blank line
aboxhall 2014/05/30 15:37:11 Done.
286 // Remove all URLs that are not allowed in an incognito session. Note that a 289 // Remove all URLs that are not allowed in an incognito session. Note that a
287 // ChromeOS guest session is not considered incognito in this case. 290 // ChromeOS guest session is not considered incognito in this case.
288 if (incognito && !GetProfile()->IsGuestSession()) { 291 if (incognito && !GetProfile()->IsGuestSession()) {
289 std::string first_url_erased; 292 std::string first_url_erased;
290 for (size_t i = 0; i < urls->size();) { 293 for (size_t i = 0; i < urls->size();) {
291 if (chrome::IsURLAllowedInIncognito((*urls)[i], GetProfile())) { 294 if (chrome::IsURLAllowedInIncognito((*urls)[i], GetProfile())) {
292 i++; 295 i++;
293 } else { 296 } else {
294 if (first_url_erased.empty()) 297 if (first_url_erased.empty())
295 first_url_erased = (*urls)[i].spec(); 298 first_url_erased = (*urls)[i].spec();
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 execute_tab_id_ = tab_id; 1739 execute_tab_id_ = tab_id;
1737 details_ = details.Pass(); 1740 details_ = details.Pass();
1738 return true; 1741 return true;
1739 } 1742 }
1740 1743
1741 bool TabsInsertCSSFunction::ShouldInsertCSS() const { 1744 bool TabsInsertCSSFunction::ShouldInsertCSS() const {
1742 return true; 1745 return true;
1743 } 1746 }
1744 1747
1745 } // namespace extensions 1748 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698