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

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

Issue 10868116: Pass result of blockage across content API when new tab blocked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // OS_WIN 10 #endif // OS_WIN
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 1294
1295 // We can synchronously update commands since they will only change once per 1295 // We can synchronously update commands since they will only change once per
1296 // navigation, so we don't have to worry about flickering. We do, however, 1296 // navigation, so we don't have to worry about flickering. We do, however,
1297 // need to update the command state early on load to always present usable 1297 // need to update the command state early on load to always present usable
1298 // actions in the face of slow-to-commit pages. 1298 // actions in the face of slow-to-commit pages.
1299 if (changed_flags & (content::INVALIDATE_TYPE_URL | 1299 if (changed_flags & (content::INVALIDATE_TYPE_URL |
1300 content::INVALIDATE_TYPE_LOAD)) 1300 content::INVALIDATE_TYPE_LOAD))
1301 command_controller_->TabStateChanged(); 1301 command_controller_->TabStateChanged();
1302 } 1302 }
1303 1303
1304 void Browser::AddNewContents(WebContents* source, 1304 bool Browser::AddNewContents(WebContents* source,
1305 WebContents* new_contents, 1305 WebContents* new_contents,
1306 WindowOpenDisposition disposition, 1306 WindowOpenDisposition disposition,
1307 const gfx::Rect& initial_pos, 1307 const gfx::Rect& initial_pos,
1308 bool user_gesture) { 1308 bool user_gesture) {
1309 chrome::AddWebContents(this, source, new_contents, disposition, initial_pos, 1309 return chrome::AddWebContents(
1310 user_gesture); 1310 this, source, new_contents, disposition, initial_pos, user_gesture);
1311 } 1311 }
1312 1312
1313 void Browser::ActivateContents(WebContents* contents) { 1313 void Browser::ActivateContents(WebContents* contents) {
1314 chrome::ActivateTabAt(this, tab_strip_model_->GetIndexOfWebContents(contents), 1314 chrome::ActivateTabAt(this, tab_strip_model_->GetIndexOfWebContents(contents),
1315 false); 1315 false);
1316 window_->Activate(); 1316 window_->Activate();
1317 } 1317 }
1318 1318
1319 void Browser::DeactivateContents(WebContents* contents) { 1319 void Browser::DeactivateContents(WebContents* contents) {
1320 window_->Deactivate(); 1320 window_->Deactivate();
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 const GURL& target_url) { 1501 const GURL& target_url) {
1502 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { 1502 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
1503 // If a BackgroundContents is created, suppress the normal WebContents. 1503 // If a BackgroundContents is created, suppress the normal WebContents.
1504 return !MaybeCreateBackgroundContents( 1504 return !MaybeCreateBackgroundContents(
1505 route_id, web_contents, frame_name, target_url); 1505 route_id, web_contents, frame_name, target_url);
1506 } 1506 }
1507 1507
1508 return true; 1508 return true;
1509 } 1509 }
1510 1510
1511 void Browser::WebContentsCreated(WebContents* source_contents, 1511 bool Browser::WebContentsCreated(WebContents* source_contents,
1512 int64 source_frame_id, 1512 int64 source_frame_id,
1513 const GURL& target_url, 1513 const GURL& target_url,
1514 WebContents* new_contents) { 1514 WebContents* new_contents) {
1515 // Adopt the WebContents now, so all observers are in place, as the network 1515 // Adopt the WebContents now, so all observers are in place, as the network
1516 // requests for its initial navigation will start immediately. The WebContents 1516 // requests for its initial navigation will start immediately. The WebContents
1517 // will later be inserted into this browser using Browser::Navigate via 1517 // will later be inserted into this browser using Browser::Navigate via
1518 // AddNewContents. 1518 // AddNewContents.
1519 AdoptAsTabContents(new_contents); 1519 AdoptAsTabContents(new_contents);
1520 1520
1521 // Notify. 1521 // Notify.
1522 RetargetingDetails details; 1522 RetargetingDetails details;
1523 details.source_web_contents = source_contents; 1523 details.source_web_contents = source_contents;
1524 details.source_frame_id = source_frame_id; 1524 details.source_frame_id = source_frame_id;
1525 details.target_url = target_url; 1525 details.target_url = target_url;
1526 details.target_web_contents = new_contents; 1526 details.target_web_contents = new_contents;
1527 details.not_yet_in_tabstrip = true; 1527 details.not_yet_in_tabstrip = true;
1528 content::NotificationService::current()->Notify( 1528 content::NotificationService::current()->Notify(
1529 chrome::NOTIFICATION_RETARGETING, 1529 chrome::NOTIFICATION_RETARGETING,
1530 content::Source<Profile>(profile_), 1530 content::Source<Profile>(profile_),
1531 content::Details<RetargetingDetails>(&details)); 1531 content::Details<RetargetingDetails>(&details));
1532
1533 return true;
1532 } 1534 }
1533 1535
1534 void Browser::ContentRestrictionsChanged(WebContents* source) { 1536 void Browser::ContentRestrictionsChanged(WebContents* source) {
1535 command_controller_->ContentRestrictionsChanged(); 1537 command_controller_->ContentRestrictionsChanged();
1536 } 1538 }
1537 1539
1538 void Browser::RendererUnresponsive(WebContents* source) { 1540 void Browser::RendererUnresponsive(WebContents* source) {
1539 // Ignore hangs if print preview is open. 1541 // Ignore hangs if print preview is open.
1540 TabContents* tab_contents = TabContents::FromWebContents(source); 1542 TabContents* tab_contents = TabContents::FromWebContents(source);
1541 if (tab_contents) { 1543 if (tab_contents) {
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 if (contents && !allow_js_access) { 2297 if (contents && !allow_js_access) {
2296 contents->web_contents()->GetController().LoadURL( 2298 contents->web_contents()->GetController().LoadURL(
2297 target_url, 2299 target_url,
2298 content::Referrer(), 2300 content::Referrer(),
2299 content::PAGE_TRANSITION_LINK, 2301 content::PAGE_TRANSITION_LINK,
2300 std::string()); // No extra headers. 2302 std::string()); // No extra headers.
2301 } 2303 }
2302 2304
2303 return contents != NULL; 2305 return contents != NULL;
2304 } 2306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698