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/ui/chrome_pages.h" | 5 #include "chrome/browser/ui/chrome_pages.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 if (sub_page.find(kInternetOptionsSubPage, 0) != std::string::npos) { | 200 if (sub_page.find(kInternetOptionsSubPage, 0) != std::string::npos) { |
201 std::string::size_type loc = sub_page.find("?", 0); | 201 std::string::size_type loc = sub_page.find("?", 0); |
202 std::string network_page = | 202 std::string network_page = |
203 loc != std::string::npos ? sub_page.substr(loc) : std::string(); | 203 loc != std::string::npos ? sub_page.substr(loc) : std::string(); |
204 url = std::string(kChromeUISettingsURL) + network_page; | 204 url = std::string(kChromeUISettingsURL) + network_page; |
205 } | 205 } |
206 #endif | 206 #endif |
207 return GURL(url); | 207 return GURL(url); |
208 } | 208 } |
209 | 209 |
210 bool IsTrustedPopupWindowWithScheme(const Browser* browser, | |
211 const std::string& scheme) { | |
212 if (!browser->is_type_popup() || !browser->is_trusted_source()) | |
213 return false; | |
214 if (scheme.empty()) // Any trusted popup window | |
215 return true; | |
216 const content::WebContents* web_contents = | |
217 browser->tab_strip_model()->GetWebContentsAt(0); | |
218 if (!web_contents) | |
219 return false; | |
220 GURL url(web_contents->GetURL()); | |
221 return url.SchemeIs(scheme.c_str()); | |
222 } | |
223 | |
224 void ShowSettings(Browser* browser) { | 210 void ShowSettings(Browser* browser) { |
225 ShowSettingsSubPage(browser, std::string()); | 211 ShowSettingsSubPage(browser, std::string()); |
226 } | 212 } |
227 | 213 |
228 void ShowSettingsSubPage(Browser* browser, const std::string& sub_page) { | 214 void ShowSettingsSubPage(Browser* browser, const std::string& sub_page) { |
229 if (::switches::SettingsWindowEnabled()) { | 215 if (::switches::SettingsWindowEnabled()) { |
230 ShowSettingsSubPageForProfile(browser->profile(), sub_page); | 216 ShowSettingsSubPageForProfile(browser->profile(), sub_page); |
231 return; | 217 return; |
232 } | 218 } |
233 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); | 219 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); | 305 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); |
320 browser = displayer->browser(); | 306 browser = displayer->browser(); |
321 } | 307 } |
322 | 308 |
323 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); | 309 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); |
324 DCHECK_GT(browser->tab_strip_model()->count(), 0); | 310 DCHECK_GT(browser->tab_strip_model()->count(), 0); |
325 } | 311 } |
326 } | 312 } |
327 | 313 |
328 } // namespace chrome | 314 } // namespace chrome |
OLD | NEW |