| 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/ui/browser_navigator.h" | 5 #include "chrome/browser/ui/browser_navigator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/ui/omnibox/location_bar.h" | 26 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 27 #include "chrome/browser/ui/status_bubble.h" | 27 #include "chrome/browser/ui/status_bubble.h" |
| 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 29 #include "chrome/browser/web_applications/web_app.h" | 29 #include "chrome/browser/web_applications/web_app.h" |
| 30 #include "chrome/common/extensions/extension.h" | 30 #include "chrome/common/extensions/extension.h" |
| 31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "content/browser/browser_url_handler.h" | 33 #include "content/browser/browser_url_handler.h" |
| 34 #include "content/browser/site_instance.h" | 34 #include "content/browser/site_instance.h" |
| 35 #include "content/browser/tab_contents/tab_contents.h" | 35 #include "content/browser/tab_contents/tab_contents.h" |
| 36 #include "content/public/browser/notification_service.h" |
| 36 #include "net/http/http_util.h" | 37 #include "net/http/http_util.h" |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 // Returns true if the specified Browser can open tabs. Not all Browsers support | 41 // Returns true if the specified Browser can open tabs. Not all Browsers support |
| 41 // multiple tabs, such as app frames and popups. This function returns false for | 42 // multiple tabs, such as app frames and popups. This function returns false for |
| 42 // those types of Browser. | 43 // those types of Browser. |
| 43 bool WindowCanOpenTabs(Browser* browser) { | 44 bool WindowCanOpenTabs(Browser* browser) { |
| 44 if (browser->tab_count() >= browser_defaults::kMaxTabCount) | 45 if (browser->tab_count() >= browser_defaults::kMaxTabCount) |
| 45 return false; | 46 return false; |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 params->url, params->referrer, params->transition, extra_headers); | 559 params->url, params->referrer, params->transition, extra_headers); |
| 559 } | 560 } |
| 560 } | 561 } |
| 561 | 562 |
| 562 // If the singleton tab isn't already selected, select it. | 563 // If the singleton tab isn't already selected, select it. |
| 563 if (params->source_contents != params->target_contents) | 564 if (params->source_contents != params->target_contents) |
| 564 params->browser->ActivateTabAt(singleton_index, user_initiated); | 565 params->browser->ActivateTabAt(singleton_index, user_initiated); |
| 565 } | 566 } |
| 566 | 567 |
| 567 if (params->disposition != CURRENT_TAB) { | 568 if (params->disposition != CURRENT_TAB) { |
| 568 NotificationService::current()->Notify( | 569 content::NotificationService::current()->Notify( |
| 569 content::NOTIFICATION_TAB_ADDED, | 570 content::NOTIFICATION_TAB_ADDED, |
| 570 content::Source<TabContentsDelegate>(params->browser), | 571 content::Source<TabContentsDelegate>(params->browser), |
| 571 content::Details<TabContents>(params->target_contents->tab_contents())); | 572 content::Details<TabContents>(params->target_contents->tab_contents())); |
| 572 } | 573 } |
| 573 } | 574 } |
| 574 | 575 |
| 575 // Returns the index of an existing singleton tab in |params->browser| matching | 576 // Returns the index of an existing singleton tab in |params->browser| matching |
| 576 // the URL specified in |params|. | 577 // the URL specified in |params|. |
| 577 int GetIndexOfSingletonTab(browser::NavigateParams* params) { | 578 int GetIndexOfSingletonTab(browser::NavigateParams* params) { |
| 578 if (params->disposition != SINGLETON_TAB) | 579 if (params->disposition != SINGLETON_TAB) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 } | 619 } |
| 619 | 620 |
| 620 bool IsURLAllowedInIncognito(const GURL& url) { | 621 bool IsURLAllowedInIncognito(const GURL& url) { |
| 621 return url.scheme() == chrome::kChromeUIScheme && | 622 return url.scheme() == chrome::kChromeUIScheme && |
| 622 (url.host() == chrome::kChromeUISettingsHost || | 623 (url.host() == chrome::kChromeUISettingsHost || |
| 623 url.host() == chrome::kChromeUIExtensionsHost || | 624 url.host() == chrome::kChromeUIExtensionsHost || |
| 624 url.host() == chrome::kChromeUIBookmarksHost); | 625 url.host() == chrome::kChromeUIBookmarksHost); |
| 625 } | 626 } |
| 626 | 627 |
| 627 } // namespace browser | 628 } // namespace browser |
| OLD | NEW |