Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 1164873003: Show origin for hosted apps that navigate away from their start origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback for the stig Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" 100 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
101 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h" 101 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h"
102 #include "chrome/browser/ui/browser_tabstrip.h" 102 #include "chrome/browser/ui/browser_tabstrip.h"
103 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" 103 #include "chrome/browser/ui/browser_toolbar_model_delegate.h"
104 #include "chrome/browser/ui/browser_ui_prefs.h" 104 #include "chrome/browser/ui/browser_ui_prefs.h"
105 #include "chrome/browser/ui/browser_window.h" 105 #include "chrome/browser/ui/browser_window.h"
106 #include "chrome/browser/ui/chrome_pages.h" 106 #include "chrome/browser/ui/chrome_pages.h"
107 #include "chrome/browser/ui/chrome_select_file_policy.h" 107 #include "chrome/browser/ui/chrome_select_file_policy.h"
108 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 108 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
109 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" 109 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h"
110 #include "chrome/browser/ui/extensions/bookmark_app_browser_controller.h" 110 #include "chrome/browser/ui/extensions/hosted_app_browser_controller.h"
111 #include "chrome/browser/ui/fast_unload_controller.h" 111 #include "chrome/browser/ui/fast_unload_controller.h"
112 #include "chrome/browser/ui/find_bar/find_bar.h" 112 #include "chrome/browser/ui/find_bar/find_bar.h"
113 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 113 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
114 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 114 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
115 #include "chrome/browser/ui/global_error/global_error.h" 115 #include "chrome/browser/ui/global_error/global_error.h"
116 #include "chrome/browser/ui/global_error/global_error_service.h" 116 #include "chrome/browser/ui/global_error/global_error_service.h"
117 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 117 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
118 #include "chrome/browser/ui/location_bar/location_bar.h" 118 #include "chrome/browser/ui/location_bar/location_bar.h"
119 #include "chrome/browser/ui/media_utils.h" 119 #include "chrome/browser/ui/media_utils.h"
120 #include "chrome/browser/ui/search/search_delegate.h" 120 #include "chrome/browser/ui/search/search_delegate.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 BrowserList::AddBrowser(this); 411 BrowserList::AddBrowser(this);
412 412
413 // NOTE: These prefs all need to be explicitly destroyed in the destructor 413 // NOTE: These prefs all need to be explicitly destroyed in the destructor
414 // or you'll get a nasty surprise when you run the incognito tests. 414 // or you'll get a nasty surprise when you run the incognito tests.
415 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, 415 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector,
416 profile_->GetPrefs()); 416 profile_->GetPrefs());
417 417
418 if (chrome::IsInstantExtendedAPIEnabled() && is_type_tabbed()) 418 if (chrome::IsInstantExtendedAPIEnabled() && is_type_tabbed())
419 instant_controller_.reset(new BrowserInstantController(this)); 419 instant_controller_.reset(new BrowserInstantController(this));
420 420
421 if (extensions::BookmarkAppBrowserController::IsForBookmarkApp(this)) { 421 if (extensions::HostedAppBrowserController::IsForHostedApp(this)) {
422 bookmark_app_controller_.reset( 422 hosted_app_controller_.reset(
423 new extensions::BookmarkAppBrowserController(this)); 423 new extensions::HostedAppBrowserController(this));
424 } 424 }
425 425
426 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT); 426 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT);
427 427
428 ProfileMetrics::LogProfileLaunch(profile_); 428 ProfileMetrics::LogProfileLaunch(profile_);
429 429
430 window_ = params.window ? params.window : CreateBrowserWindow(this); 430 window_ = params.window ? params.window : CreateBrowserWindow(this);
431 431
432 if (bookmark_app_controller_) 432 if (hosted_app_controller_)
433 bookmark_app_controller_->UpdateLocationBarVisibility(false); 433 hosted_app_controller_->UpdateLocationBarVisibility(false);
434 434
435 // Create the extension window controller before sending notifications. 435 // Create the extension window controller before sending notifications.
436 extension_window_controller_.reset( 436 extension_window_controller_.reset(
437 new BrowserExtensionWindowController(this)); 437 new BrowserExtensionWindowController(this));
438 438
439 SessionService* session_service = 439 SessionService* session_service =
440 SessionServiceFactory::GetForProfileForSessionRestore(profile_); 440 SessionServiceFactory::GetForProfileForSessionRestore(profile_);
441 if (session_service) 441 if (session_service)
442 session_service->WindowOpened(this); 442 session_service->WindowOpened(this);
443 443
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 FROM_HERE_WITH_EXPLICIT_FUNCTION( 1431 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1432 "466285 Browser::NavigationStateChanged::TabStateChanged")); 1432 "466285 Browser::NavigationStateChanged::TabStateChanged"));
1433 // We can synchronously update commands since they will only change once per 1433 // We can synchronously update commands since they will only change once per
1434 // navigation, so we don't have to worry about flickering. We do, however, 1434 // navigation, so we don't have to worry about flickering. We do, however,
1435 // need to update the command state early on load to always present usable 1435 // need to update the command state early on load to always present usable
1436 // actions in the face of slow-to-commit pages. 1436 // actions in the face of slow-to-commit pages.
1437 if (changed_flags & (content::INVALIDATE_TYPE_URL | 1437 if (changed_flags & (content::INVALIDATE_TYPE_URL |
1438 content::INVALIDATE_TYPE_LOAD)) 1438 content::INVALIDATE_TYPE_LOAD))
1439 command_controller_->TabStateChanged(); 1439 command_controller_->TabStateChanged();
1440 1440
1441 if (bookmark_app_controller_) 1441 if (hosted_app_controller_)
1442 bookmark_app_controller_->UpdateLocationBarVisibility(true); 1442 hosted_app_controller_->UpdateLocationBarVisibility(true);
1443 } 1443 }
1444 1444
1445 void Browser::VisibleSSLStateChanged(const WebContents* source) { 1445 void Browser::VisibleSSLStateChanged(const WebContents* source) {
1446 // When the current tab's SSL state changes, we need to update the URL 1446 // When the current tab's SSL state changes, we need to update the URL
1447 // bar to reflect the new state. 1447 // bar to reflect the new state.
1448 DCHECK(source); 1448 DCHECK(source);
1449 if (tab_strip_model_->GetActiveWebContents() == source) 1449 if (tab_strip_model_->GetActiveWebContents() == source)
1450 UpdateToolbar(false); 1450 UpdateToolbar(false);
1451 } 1451 }
1452 1452
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
2422 bool Browser::SupportsLocationBar() const { 2422 bool Browser::SupportsLocationBar() const {
2423 // Tabbed browser always show a location bar. 2423 // Tabbed browser always show a location bar.
2424 if (is_type_tabbed()) 2424 if (is_type_tabbed())
2425 return true; 2425 return true;
2426 2426
2427 // Non-app windows that aren't tabbed or system windows should always show a 2427 // Non-app windows that aren't tabbed or system windows should always show a
2428 // location bar, unless they are from a trusted source. 2428 // location bar, unless they are from a trusted source.
2429 if (!is_app()) 2429 if (!is_app())
2430 return !is_trusted_source(); 2430 return !is_trusted_source();
2431 2431
2432 if (bookmark_app_controller_) 2432 if (hosted_app_controller_)
2433 return bookmark_app_controller_->SupportsLocationBar(); 2433 return hosted_app_controller_->SupportsLocationBar();
2434 2434
2435 return false; 2435 return false;
2436 } 2436 }
2437 2437
2438 bool Browser::ShouldUseWebAppFrame() const { 2438 bool Browser::ShouldUseWebAppFrame() const {
2439 // Only use the web app frame for apps in ash, and only if the web app frame 2439 // Only use the web app frame for apps in ash, and only if the web app frame
2440 // is enabled. 2440 // is enabled.
2441 if (!is_app()) 2441 if (!is_app())
2442 return false; 2442 return false;
2443 2443
2444 if (bookmark_app_controller_) 2444 if (hosted_app_controller_)
2445 return bookmark_app_controller_->should_use_web_app_frame(); 2445 return hosted_app_controller_->should_use_web_app_frame();
2446 2446
2447 return false; 2447 return false;
2448 } 2448 }
2449 2449
2450 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, 2450 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
2451 bool check_fullscreen) const { 2451 bool check_fullscreen) const {
2452 bool hide_ui_for_fullscreen = check_fullscreen && ShouldHideUIForFullscreen(); 2452 bool hide_ui_for_fullscreen = check_fullscreen && ShouldHideUIForFullscreen();
2453 2453
2454 unsigned int features = FEATURE_INFOBAR | FEATURE_DOWNLOADSHELF; 2454 unsigned int features = FEATURE_INFOBAR | FEATURE_DOWNLOADSHELF;
2455 2455
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2618 if (contents && !allow_js_access) { 2618 if (contents && !allow_js_access) {
2619 contents->web_contents()->GetController().LoadURL( 2619 contents->web_contents()->GetController().LoadURL(
2620 target_url, 2620 target_url,
2621 content::Referrer(), 2621 content::Referrer(),
2622 ui::PAGE_TRANSITION_LINK, 2622 ui::PAGE_TRANSITION_LINK,
2623 std::string()); // No extra headers. 2623 std::string()); // No extra headers.
2624 } 2624 }
2625 2625
2626 return contents != NULL; 2626 return contents != NULL;
2627 } 2627 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698