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

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

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict Created 5 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
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/exclusive_access/fullscreen_controller.h" 5 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "chrome/browser/app_mode/app_mode_utils.h" 12 #include "chrome/browser/app_mode/app_mode_utils.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" 16 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
16 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" 17 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
17 #include "chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h" 18 #include "chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h"
18 #include "chrome/browser/ui/status_bubble.h" 19 #include "chrome/browser/ui/status_bubble.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "chrome/browser/ui/web_contents_sizer.h" 21 #include "chrome/browser/ui/web_contents_sizer.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "components/content_settings/core/browser/host_content_settings_map.h" 23 #include "components/content_settings/core/browser/host_content_settings_map.h"
23 #include "content/public/browser/navigation_details.h" 24 #include "content/public/browser/navigation_details.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 ContentSettingsPattern::FromURLNoWildcard(embedder); 346 ContentSettingsPattern::FromURLNoWildcard(embedder);
346 347
347 // ContentSettings requires valid patterns and the patterns might be invalid 348 // ContentSettings requires valid patterns and the patterns might be invalid
348 // in some edge cases like if the current frame is about:blank. 349 // in some edge cases like if the current frame is about:blank.
349 // 350 //
350 // Do not store preference on file:// URLs, they don't have a clean 351 // Do not store preference on file:// URLs, they don't have a clean
351 // origin policy. 352 // origin policy.
352 // TODO(estark): Revisit this when crbug.com/455882 is fixed. 353 // TODO(estark): Revisit this when crbug.com/455882 is fixed.
353 if (!requester.SchemeIsFile() && !embedder.SchemeIsFile() && 354 if (!requester.SchemeIsFile() && !embedder.SchemeIsFile() &&
354 primary_pattern.IsValid() && secondary_pattern.IsValid()) { 355 primary_pattern.IsValid() && secondary_pattern.IsValid()) {
355 HostContentSettingsMap* settings_map = exclusive_access_manager() 356 HostContentSettingsMap* settings_map =
356 ->context() 357 HostContentSettingsMapFactory::GetForProfile(
357 ->GetProfile() 358 exclusive_access_manager()->context()->GetProfile());
358 ->GetHostContentSettingsMap();
359 settings_map->SetContentSetting( 359 settings_map->SetContentSetting(
360 primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_FULLSCREEN, 360 primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_FULLSCREEN,
361 std::string(), CONTENT_SETTING_ALLOW); 361 std::string(), CONTENT_SETTING_ALLOW);
362 } 362 }
363 tab_fullscreen_accepted_ = true; 363 tab_fullscreen_accepted_ = true;
364 return true; 364 return true;
365 } 365 }
366 366
367 return false; 367 return false;
368 } 368 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // decision stick for a particular origin. 521 // decision stick for a particular origin.
522 // TODO(estark): Revisit this when crbug.com/455882 is fixed. 522 // TODO(estark): Revisit this when crbug.com/455882 is fixed.
523 if (url.SchemeIsFile()) 523 if (url.SchemeIsFile())
524 return CONTENT_SETTING_ASK; 524 return CONTENT_SETTING_ASK;
525 525
526 if (IsPrivilegedFullscreenForTab()) 526 if (IsPrivilegedFullscreenForTab())
527 return CONTENT_SETTING_ALLOW; 527 return CONTENT_SETTING_ALLOW;
528 528
529 // If the permission was granted to the website with no embedder, it should 529 // If the permission was granted to the website with no embedder, it should
530 // always be allowed, even if embedded. 530 // always be allowed, even if embedded.
531 if (exclusive_access_manager() 531 if (HostContentSettingsMapFactory::GetForProfile(
532 ->context() 532 exclusive_access_manager()->context()->GetProfile())
533 ->GetProfile() 533 ->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_FULLSCREEN,
534 ->GetHostContentSettingsMap() 534 std::string()) == CONTENT_SETTING_ALLOW) {
535 ->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_FULLSCREEN,
536 std::string()) == CONTENT_SETTING_ALLOW) {
537 return CONTENT_SETTING_ALLOW; 535 return CONTENT_SETTING_ALLOW;
538 } 536 }
539 537
540 // See the comment above the call to |SetContentSetting()| for how the 538 // See the comment above the call to |SetContentSetting()| for how the
541 // requesting and embedding origins interact with each other wrt permissions. 539 // requesting and embedding origins interact with each other wrt permissions.
542 return exclusive_access_manager() 540 return HostContentSettingsMapFactory::GetForProfile(
543 ->context() 541 exclusive_access_manager()->context()->GetProfile())
544 ->GetProfile() 542 ->GetContentSetting(url, GetEmbeddingOrigin(),
545 ->GetHostContentSettingsMap() 543 CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string());
546 ->GetContentSetting(url, GetEmbeddingOrigin(),
547 CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string());
548 } 544 }
549 545
550 bool FullscreenController::IsPrivilegedFullscreenForTab() const { 546 bool FullscreenController::IsPrivilegedFullscreenForTab() const {
551 const bool embedded_widget_present = 547 const bool embedded_widget_present =
552 exclusive_access_tab() && 548 exclusive_access_tab() &&
553 exclusive_access_tab()->GetFullscreenRenderWidgetHostView(); 549 exclusive_access_tab()->GetFullscreenRenderWidgetHostView();
554 return embedded_widget_present || is_privileged_fullscreen_for_testing_; 550 return embedded_widget_present || is_privileged_fullscreen_for_testing_;
555 } 551 }
556 552
557 void FullscreenController::SetPrivilegedFullscreenForTesting( 553 void FullscreenController::SetPrivilegedFullscreenForTesting(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 return fullscreened_origin_; 596 return fullscreened_origin_;
601 597
602 return exclusive_access_tab()->GetLastCommittedURL(); 598 return exclusive_access_tab()->GetLastCommittedURL();
603 } 599 }
604 600
605 GURL FullscreenController::GetEmbeddingOrigin() const { 601 GURL FullscreenController::GetEmbeddingOrigin() const {
606 DCHECK(exclusive_access_tab()); 602 DCHECK(exclusive_access_tab());
607 603
608 return exclusive_access_tab()->GetLastCommittedURL(); 604 return exclusive_access_tab()->GetLastCommittedURL();
609 } 605 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698