| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "chrome/browser/devtools/devtools_toggle_action.h" | 47 #include "chrome/browser/devtools/devtools_toggle_action.h" |
| 48 #include "chrome/browser/devtools/devtools_window.h" | 48 #include "chrome/browser/devtools/devtools_window.h" |
| 49 #include "chrome/browser/download/download_item_model.h" | 49 #include "chrome/browser/download/download_item_model.h" |
| 50 #include "chrome/browser/download/download_service.h" | 50 #include "chrome/browser/download/download_service.h" |
| 51 #include "chrome/browser/download/download_service_factory.h" | 51 #include "chrome/browser/download/download_service_factory.h" |
| 52 #include "chrome/browser/download/download_shelf.h" | 52 #include "chrome/browser/download/download_shelf.h" |
| 53 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" | 53 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" |
| 54 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" | 54 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" |
| 55 #include "chrome/browser/extensions/browser_extension_window_controller.h" | 55 #include "chrome/browser/extensions/browser_extension_window_controller.h" |
| 56 #include "chrome/browser/extensions/extension_service.h" | 56 #include "chrome/browser/extensions/extension_service.h" |
| 57 #include "chrome/browser/extensions/extension_util.h" |
| 57 #include "chrome/browser/extensions/tab_helper.h" | 58 #include "chrome/browser/extensions/tab_helper.h" |
| 58 #include "chrome/browser/favicon/favicon_tab_helper.h" | 59 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 59 #include "chrome/browser/file_select_helper.h" | 60 #include "chrome/browser/file_select_helper.h" |
| 60 #include "chrome/browser/first_run/first_run.h" | 61 #include "chrome/browser/first_run/first_run.h" |
| 61 #include "chrome/browser/history/top_sites.h" | 62 #include "chrome/browser/history/top_sites.h" |
| 62 #include "chrome/browser/infobars/infobar_service.h" | 63 #include "chrome/browser/infobars/infobar_service.h" |
| 63 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" | 64 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
| 64 #include "chrome/browser/lifetime/application_lifetime.h" | 65 #include "chrome/browser/lifetime/application_lifetime.h" |
| 65 #include "chrome/browser/notifications/notification_ui_manager.h" | 66 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 66 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 67 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 } | 571 } |
| 571 | 572 |
| 572 base::string16 Browser::GetWindowTitleForCurrentTab() const { | 573 base::string16 Browser::GetWindowTitleForCurrentTab() const { |
| 573 WebContents* contents = tab_strip_model_->GetActiveWebContents(); | 574 WebContents* contents = tab_strip_model_->GetActiveWebContents(); |
| 574 base::string16 title; | 575 base::string16 title; |
| 575 | 576 |
| 576 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the | 577 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the |
| 577 // window during the window's creation (before tabs have been added). | 578 // window during the window's creation (before tabs have been added). |
| 578 if (contents) { | 579 if (contents) { |
| 579 // Streamlined hosted apps use the host instead of the title. | 580 // Streamlined hosted apps use the host instead of the title. |
| 580 if (is_app() && CommandLine::ForCurrentProcess()->HasSwitch( | 581 if (is_app() && extensions::util::IsStreamlinedHostedAppsEnabled()) |
| 581 switches::kEnableStreamlinedHostedApps)) { | |
| 582 return base::UTF8ToUTF16(contents->GetURL().host()); | 582 return base::UTF8ToUTF16(contents->GetURL().host()); |
| 583 } | |
| 584 | 583 |
| 585 title = contents->GetTitle(); | 584 title = contents->GetTitle(); |
| 586 FormatTitleForDisplay(&title); | 585 FormatTitleForDisplay(&title); |
| 587 } | 586 } |
| 588 if (title.empty()) | 587 if (title.empty()) |
| 589 title = CoreTabHelper::GetDefaultTitle(); | 588 title = CoreTabHelper::GetDefaultTitle(); |
| 590 | 589 |
| 591 #if defined(OS_MACOSX) | 590 #if defined(OS_MACOSX) |
| 592 // On Mac, we don't want to suffix the page title with | 591 // On Mac, we don't want to suffix the page title with |
| 593 // the application name. | 592 // the application name. |
| (...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2298 return; | 2297 return; |
| 2299 } | 2298 } |
| 2300 } | 2299 } |
| 2301 | 2300 |
| 2302 bool Browser::ShouldShowLocationBar() const { | 2301 bool Browser::ShouldShowLocationBar() const { |
| 2303 // Tabbed browser always show a location bar. | 2302 // Tabbed browser always show a location bar. |
| 2304 if (is_type_tabbed()) | 2303 if (is_type_tabbed()) |
| 2305 return true; | 2304 return true; |
| 2306 | 2305 |
| 2307 if (is_app()) { | 2306 if (is_app()) { |
| 2308 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2307 if (extensions::util::IsStreamlinedHostedAppsEnabled() && |
| 2309 switches::kEnableStreamlinedHostedApps) && | |
| 2310 host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { | 2308 host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { |
| 2311 // If kEnableStreamlinedHostedApps is true, show the location bar for | 2309 // If streamlined hosted apps are enabled, show the location bar for |
| 2312 // bookmark apps, except on ash which has the toolbar merged into the | 2310 // bookmark apps, except on ash which has the toolbar merged into the |
| 2313 // frame. | 2311 // frame. |
| 2314 ExtensionService* service = | 2312 ExtensionService* service = |
| 2315 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 2313 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 2316 const extensions::Extension* extension = | 2314 const extensions::Extension* extension = |
| 2317 service ? service->GetInstalledExtension( | 2315 service ? service->GetInstalledExtension( |
| 2318 web_app::GetExtensionIdFromApplicationName(app_name())) | 2316 web_app::GetExtensionIdFromApplicationName(app_name())) |
| 2319 : NULL; | 2317 : NULL; |
| 2320 return (!extension || extension->from_bookmark()) && | 2318 return (!extension || extension->from_bookmark()) && |
| 2321 app_name() != DevToolsWindow::kDevToolsApp; | 2319 app_name() != DevToolsWindow::kDevToolsApp; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2477 if (contents && !allow_js_access) { | 2475 if (contents && !allow_js_access) { |
| 2478 contents->web_contents()->GetController().LoadURL( | 2476 contents->web_contents()->GetController().LoadURL( |
| 2479 target_url, | 2477 target_url, |
| 2480 content::Referrer(), | 2478 content::Referrer(), |
| 2481 content::PAGE_TRANSITION_LINK, | 2479 content::PAGE_TRANSITION_LINK, |
| 2482 std::string()); // No extra headers. | 2480 std::string()); // No extra headers. |
| 2483 } | 2481 } |
| 2484 | 2482 |
| 2485 return contents != NULL; | 2483 return contents != NULL; |
| 2486 } | 2484 } |
| OLD | NEW |