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

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

Issue 2410043003: Add a console messsage for HTTP-bad (Closed)
Patch Set: cleanup Created 4 years, 2 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
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 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 initial_workspace_(params.initial_workspace), 355 initial_workspace_(params.initial_workspace),
356 is_session_restore_(params.is_session_restore), 356 is_session_restore_(params.is_session_restore),
357 content_setting_bubble_model_delegate_( 357 content_setting_bubble_model_delegate_(
358 new BrowserContentSettingBubbleModelDelegate(this)), 358 new BrowserContentSettingBubbleModelDelegate(this)),
359 toolbar_model_delegate_(new BrowserToolbarModelDelegate(this)), 359 toolbar_model_delegate_(new BrowserToolbarModelDelegate(this)),
360 live_tab_context_(new BrowserLiveTabContext(this)), 360 live_tab_context_(new BrowserLiveTabContext(this)),
361 synced_window_delegate_(new BrowserSyncedWindowDelegate(this)), 361 synced_window_delegate_(new BrowserSyncedWindowDelegate(this)),
362 bookmark_bar_state_(BookmarkBar::HIDDEN), 362 bookmark_bar_state_(BookmarkBar::HIDDEN),
363 command_controller_(new chrome::BrowserCommandController(this)), 363 command_controller_(new chrome::BrowserCommandController(this)),
364 window_has_shown_(false), 364 window_has_shown_(false),
365 logged_http_warning_on_current_navigation_(false),
365 chrome_updater_factory_(this), 366 chrome_updater_factory_(this),
366 weak_factory_(this) { 367 weak_factory_(this) {
367 // If this causes a crash then a window is being opened using a profile type 368 // If this causes a crash then a window is being opened using a profile type
368 // that is disallowed by policy. The crash prevents the disabled window type 369 // that is disallowed by policy. The crash prevents the disabled window type
369 // from opening at all, but the path that triggered it should be fixed. 370 // from opening at all, but the path that triggered it should be fixed.
370 CHECK(IncognitoModePrefs::CanOpenBrowser(profile_)); 371 CHECK(IncognitoModePrefs::CanOpenBrowser(profile_));
371 CHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord()) 372 CHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord())
372 << "Only off the record browser may be opened in guest mode"; 373 << "Only off the record browser may be opened in guest mode";
373 DCHECK(!profile_->IsSystemProfile()) 374 DCHECK(!profile_->IsSystemProfile())
374 << "The system profile should never have a real browser."; 375 << "The system profile should never have a real browser.";
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 if (hosted_app_controller_) 1424 if (hosted_app_controller_)
1424 hosted_app_controller_->UpdateLocationBarVisibility(true); 1425 hosted_app_controller_->UpdateLocationBarVisibility(true);
1425 } 1426 }
1426 1427
1427 void Browser::VisibleSSLStateChanged(const WebContents* source) { 1428 void Browser::VisibleSSLStateChanged(const WebContents* source) {
1428 // When the current tab's SSL state changes, we need to update the URL 1429 // When the current tab's SSL state changes, we need to update the URL
1429 // bar to reflect the new state. 1430 // bar to reflect the new state.
1430 DCHECK(source); 1431 DCHECK(source);
1431 if (tab_strip_model_->GetActiveWebContents() == source) 1432 if (tab_strip_model_->GetActiveWebContents() == source)
1432 UpdateToolbar(false); 1433 UpdateToolbar(false);
1434
1435 if (!logged_http_warning_on_current_navigation_) {
msw 2016/10/13 23:58:01 I'm not sure if this is the right place for this l
1436 const ChromeSecurityStateModelClient* security_model =
1437 ChromeSecurityStateModelClient::FromWebContents(source);
1438 security_state::SecurityStateModel::SecurityInfo security_info;
1439 security_model->GetSecurityInfo(&security_info);
1440 if (security_info.security_level ==
1441 security_state::SecurityStateModel::HTTP_SHOW_WARNING) {
1442 tab_strip_model_->GetActiveWebContents()
1443 ->GetMainFrame()
1444 ->AddMessageToConsole(
1445 content::CONSOLE_MESSAGE_LEVEL_WARNING,
1446 "In Chrome M56 (Jan 2017), this page will be marked "
1447 "as \"not secure\" in the URL bar. For more "
1448 "information see https://goo.gl/zmWq3m");
elawrence 2016/10/14 15:12:27 trivial: comma after "information"?
estark 2016/10/14 17:57:06 Done.
1449 logged_http_warning_on_current_navigation_ = true;
1450 }
1451 }
1433 } 1452 }
1434 1453
1435 void Browser::AddNewContents(WebContents* source, 1454 void Browser::AddNewContents(WebContents* source,
1436 WebContents* new_contents, 1455 WebContents* new_contents,
1437 WindowOpenDisposition disposition, 1456 WindowOpenDisposition disposition,
1438 const gfx::Rect& initial_rect, 1457 const gfx::Rect& initial_rect,
1439 bool user_gesture, 1458 bool user_gesture,
1440 bool* was_blocked) { 1459 bool* was_blocked) {
1441 chrome::AddWebContents(this, source, new_contents, disposition, initial_rect, 1460 chrome::AddWebContents(this, source, new_contents, disposition, initial_rect,
1442 user_gesture, was_blocked); 1461 user_gesture, was_blocked);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 TabDialogs::FromWebContents(source)->ShowHungRendererDialog(); 1653 TabDialogs::FromWebContents(source)->ShowHungRendererDialog();
1635 } 1654 }
1636 1655
1637 void Browser::RendererResponsive(WebContents* source) { 1656 void Browser::RendererResponsive(WebContents* source) {
1638 TabDialogs::FromWebContents(source)->HideHungRendererDialog(); 1657 TabDialogs::FromWebContents(source)->HideHungRendererDialog();
1639 } 1658 }
1640 1659
1641 void Browser::DidNavigateMainFramePostCommit(WebContents* web_contents) { 1660 void Browser::DidNavigateMainFramePostCommit(WebContents* web_contents) {
1642 if (web_contents == tab_strip_model_->GetActiveWebContents()) 1661 if (web_contents == tab_strip_model_->GetActiveWebContents())
1643 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); 1662 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
1663 // Reset the flag that prevents logging an HTTP warning message more
1664 // than once per main-frame navigation.
1665 logged_http_warning_on_current_navigation_ = false;
sky 2016/10/14 16:44:03 Browser is the delegate of multiple WebContents. l
estark 2016/10/14 17:57:06 Ah, right, that makes sense. I forwarded VisibleSS
1644 } 1666 }
1645 1667
1646 content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager( 1668 content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
1647 WebContents* source) { 1669 WebContents* source) {
1648 return JavaScriptDialogTabHelper::FromWebContents(source); 1670 return JavaScriptDialogTabHelper::FromWebContents(source);
1649 } 1671 }
1650 1672
1651 content::ColorChooser* Browser::OpenColorChooser( 1673 content::ColorChooser* Browser::OpenColorChooser(
1652 WebContents* web_contents, 1674 WebContents* web_contents,
1653 SkColor initial_color, 1675 SkColor initial_color,
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 if (contents && !allow_js_access) { 2592 if (contents && !allow_js_access) {
2571 contents->web_contents()->GetController().LoadURL( 2593 contents->web_contents()->GetController().LoadURL(
2572 target_url, 2594 target_url,
2573 content::Referrer(), 2595 content::Referrer(),
2574 ui::PAGE_TRANSITION_LINK, 2596 ui::PAGE_TRANSITION_LINK,
2575 std::string()); // No extra headers. 2597 std::string()); // No extra headers.
2576 } 2598 }
2577 2599
2578 return contents != NULL; 2600 return contents != NULL;
2579 } 2601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698