| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "chrome/browser/devtools/devtools_toggle_action.h" | 48 #include "chrome/browser/devtools/devtools_toggle_action.h" |
| 49 #include "chrome/browser/devtools/devtools_window.h" | 49 #include "chrome/browser/devtools/devtools_window.h" |
| 50 #include "chrome/browser/download/download_item_model.h" | 50 #include "chrome/browser/download/download_item_model.h" |
| 51 #include "chrome/browser/download/download_service.h" | 51 #include "chrome/browser/download/download_service.h" |
| 52 #include "chrome/browser/download/download_service_factory.h" | 52 #include "chrome/browser/download/download_service_factory.h" |
| 53 #include "chrome/browser/download/download_shelf.h" | 53 #include "chrome/browser/download/download_shelf.h" |
| 54 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" | 54 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" |
| 55 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" | 55 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" |
| 56 #include "chrome/browser/extensions/browser_extension_window_controller.h" | 56 #include "chrome/browser/extensions/browser_extension_window_controller.h" |
| 57 #include "chrome/browser/extensions/extension_service.h" | 57 #include "chrome/browser/extensions/extension_service.h" |
| 58 #include "chrome/browser/extensions/extension_ui_util.h" |
| 58 #include "chrome/browser/extensions/extension_util.h" | 59 #include "chrome/browser/extensions/extension_util.h" |
| 59 #include "chrome/browser/extensions/tab_helper.h" | 60 #include "chrome/browser/extensions/tab_helper.h" |
| 60 #include "chrome/browser/favicon/favicon_tab_helper.h" | 61 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 61 #include "chrome/browser/file_select_helper.h" | 62 #include "chrome/browser/file_select_helper.h" |
| 62 #include "chrome/browser/first_run/first_run.h" | 63 #include "chrome/browser/first_run/first_run.h" |
| 63 #include "chrome/browser/history/top_sites_factory.h" | 64 #include "chrome/browser/history/top_sites_factory.h" |
| 64 #include "chrome/browser/infobars/infobar_service.h" | 65 #include "chrome/browser/infobars/infobar_service.h" |
| 65 #include "chrome/browser/lifetime/application_lifetime.h" | 66 #include "chrome/browser/lifetime/application_lifetime.h" |
| 66 #include "chrome/browser/notifications/notification_ui_manager.h" | 67 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 67 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 68 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
| (...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 interstitial_observers_.erase(interstitial_observers_.begin() + i); | 2407 interstitial_observers_.erase(interstitial_observers_.begin() + i); |
| 2407 return; | 2408 return; |
| 2408 } | 2409 } |
| 2409 } | 2410 } |
| 2410 | 2411 |
| 2411 bool Browser::ShouldShowLocationBar() const { | 2412 bool Browser::ShouldShowLocationBar() const { |
| 2412 // Tabbed browser always show a location bar. | 2413 // Tabbed browser always show a location bar. |
| 2413 if (is_type_tabbed()) | 2414 if (is_type_tabbed()) |
| 2414 return true; | 2415 return true; |
| 2415 | 2416 |
| 2416 // Trusted app windows and system windows never show a location bar. | 2417 // Non-app windows that aren't tabbed or system windows should always show a |
| 2417 return !is_app() && !is_trusted_source(); | 2418 // location bar, unless they are from a trusted source. |
| 2419 if (!is_app()) |
| 2420 return !is_trusted_source(); |
| 2421 |
| 2422 if (ShouldUseWebAppFrame()) |
| 2423 return false; |
| 2424 |
| 2425 // Bookmark apps should show the location bar. |
| 2426 const std::string extension_id = |
| 2427 web_app::GetExtensionIdFromApplicationName(app_name()); |
| 2428 const extensions::Extension* extension = |
| 2429 extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 2430 extension_id, extensions::ExtensionRegistry::EVERYTHING); |
| 2431 return extensions::ui_util::ShouldShowLocationBar( |
| 2432 extension, tab_strip_model_->GetActiveWebContents()); |
| 2418 } | 2433 } |
| 2419 | 2434 |
| 2420 bool Browser::ShouldUseWebAppFrame() const { | 2435 bool Browser::ShouldUseWebAppFrame() const { |
| 2421 // Only use the web app frame for apps in ash, and only if bookmark apps are | 2436 // Only use the web app frame for apps in ash, and only if the web app frame |
| 2422 // enabled. | 2437 // is enabled. |
| 2423 if (!is_app() || host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH || | 2438 if (!is_app() || host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH || |
| 2424 !IsWebAppFrameEnabled()) { | 2439 !IsWebAppFrameEnabled()) { |
| 2425 return false; | 2440 return false; |
| 2426 } | 2441 } |
| 2427 | 2442 |
| 2428 // Use the web app frame for hosted apps (which include bookmark apps). | 2443 // Use the web app frame for hosted apps. |
| 2429 const std::string extension_id = | 2444 const std::string extension_id = |
| 2430 web_app::GetExtensionIdFromApplicationName(app_name()); | 2445 web_app::GetExtensionIdFromApplicationName(app_name()); |
| 2431 const extensions::Extension* extension = | 2446 const extensions::Extension* extension = |
| 2432 extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( | 2447 extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 2433 extension_id, extensions::ExtensionRegistry::EVERYTHING); | 2448 extension_id, extensions::ExtensionRegistry::EVERYTHING); |
| 2434 return extension && extension->is_hosted_app(); | 2449 return extension && extension->is_hosted_app(); |
| 2435 } | 2450 } |
| 2436 | 2451 |
| 2437 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, | 2452 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, |
| 2438 bool check_fullscreen) const { | 2453 bool check_fullscreen) const { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 if (contents && !allow_js_access) { | 2604 if (contents && !allow_js_access) { |
| 2590 contents->web_contents()->GetController().LoadURL( | 2605 contents->web_contents()->GetController().LoadURL( |
| 2591 target_url, | 2606 target_url, |
| 2592 content::Referrer(), | 2607 content::Referrer(), |
| 2593 ui::PAGE_TRANSITION_LINK, | 2608 ui::PAGE_TRANSITION_LINK, |
| 2594 std::string()); // No extra headers. | 2609 std::string()); // No extra headers. |
| 2595 } | 2610 } |
| 2596 | 2611 |
| 2597 return contents != NULL; | 2612 return contents != NULL; |
| 2598 } | 2613 } |
| OLD | NEW |