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_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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // appropriate message if the tab cannot be found by id. | 126 // appropriate message if the tab cannot be found by id. |
127 bool GetTabById(int tab_id, | 127 bool GetTabById(int tab_id, |
128 Profile* profile, | 128 Profile* profile, |
129 bool include_incognito, | 129 bool include_incognito, |
130 Browser** browser, | 130 Browser** browser, |
131 TabStripModel** tab_strip, | 131 TabStripModel** tab_strip, |
132 content::WebContents** contents, | 132 content::WebContents** contents, |
133 int* tab_index, | 133 int* tab_index, |
134 std::string* error_message) { | 134 std::string* error_message) { |
135 if (ExtensionTabUtil::GetTabById(tab_id, profile, include_incognito, | 135 if (ExtensionTabUtil::GetTabById(tab_id, profile, include_incognito, |
136 browser, tab_strip, contents, tab_index)) | 136 browser, tab_strip, contents, tab_index)) { |
137 return true; | 137 return true; |
| 138 } |
138 | 139 |
139 if (error_message) | 140 if (error_message) { |
140 *error_message = ErrorUtils::FormatErrorMessage( | 141 *error_message = ErrorUtils::FormatErrorMessage( |
141 keys::kTabNotFoundError, base::IntToString(tab_id)); | 142 keys::kTabNotFoundError, base::IntToString(tab_id)); |
| 143 } |
142 | 144 |
143 return false; | 145 return false; |
144 } | 146 } |
145 | 147 |
146 // Returns true if either |boolean| is a null pointer, or if |*boolean| and | 148 // Returns true if either |boolean| is a null pointer, or if |*boolean| and |
147 // |value| are equal. This function is used to check if a tab's parameters match | 149 // |value| are equal. This function is used to check if a tab's parameters match |
148 // those of the browser. | 150 // those of the browser. |
149 bool MatchesBool(bool* boolean, bool value) { | 151 bool MatchesBool(bool* boolean, bool value) { |
150 return !boolean || *boolean == value; | 152 return !boolean || *boolean == value; |
151 } | 153 } |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 execute_tab_id_ = tab_id; | 1739 execute_tab_id_ = tab_id; |
1738 details_ = details.Pass(); | 1740 details_ = details.Pass(); |
1739 return true; | 1741 return true; |
1740 } | 1742 } |
1741 | 1743 |
1742 bool TabsInsertCSSFunction::ShouldInsertCSS() const { | 1744 bool TabsInsertCSSFunction::ShouldInsertCSS() const { |
1743 return true; | 1745 return true; |
1744 } | 1746 } |
1745 | 1747 |
1746 } // namespace extensions | 1748 } // namespace extensions |
OLD | NEW |