| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" | 5 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/browser/plugins/plugin_finder.h" | 15 #include "chrome/browser/plugins/plugin_finder.h" |
| 16 #include "chrome/browser/plugins/plugin_metadata.h" | 16 #include "chrome/browser/plugins/plugin_metadata.h" |
| 17 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 17 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 18 #import "chrome/browser/ui/cocoa/l10n_util.h" | 18 #import "chrome/browser/ui/cocoa/l10n_util.h" |
| 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 20 #include "chrome/browser/ui/content_settings/content_setting_media_menu_model.h" | 20 #include "chrome/browser/ui/content_settings/content_setting_media_menu_model.h" |
| 21 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" | 21 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" |
| 22 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
| 23 #include "components/content_settings/core/browser/host_content_settings_map.h" | 23 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 24 #include "content/public/browser/navigation_handle.h" |
| 24 #include "content/public/browser/plugin_service.h" | 25 #include "content/public/browser/plugin_service.h" |
| 25 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
| 26 #include "skia/ext/skia_utils_mac.h" | 27 #include "skia/ext/skia_utils_mac.h" |
| 27 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 28 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
| 28 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 29 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 | 31 |
| 31 using content::PluginService; | 32 using content::PluginService; |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 public: | 181 public: |
| 181 ContentSettingBubbleWebContentsObserverBridge( | 182 ContentSettingBubbleWebContentsObserverBridge( |
| 182 content::WebContents* web_contents, | 183 content::WebContents* web_contents, |
| 183 ContentSettingBubbleController* controller) | 184 ContentSettingBubbleController* controller) |
| 184 : content::WebContentsObserver(web_contents), | 185 : content::WebContentsObserver(web_contents), |
| 185 controller_(controller) { | 186 controller_(controller) { |
| 186 } | 187 } |
| 187 | 188 |
| 188 protected: | 189 protected: |
| 189 // WebContentsObserver: | 190 // WebContentsObserver: |
| 190 void DidNavigateMainFrame( | 191 void DidFinishNavigation( |
| 191 const content::LoadCommittedDetails& details, | 192 content::NavigationHandle* navigation_handle) override { |
| 192 const content::FrameNavigateParams& params) override { | 193 if (!navigation_handle->IsInMainFrame() || |
| 194 !navigation_handle->HasCommitted()) { |
| 195 return; |
| 196 } |
| 193 // Content settings are based on the main frame, so if it switches then | 197 // Content settings are based on the main frame, so if it switches then |
| 194 // close up shop. | 198 // close up shop. |
| 195 [controller_ closeBubble:nil]; | 199 [controller_ closeBubble:nil]; |
| 196 } | 200 } |
| 197 | 201 |
| 198 private: | 202 private: |
| 199 ContentSettingBubbleController* controller_; // weak | 203 ContentSettingBubbleController* controller_; // weak |
| 200 | 204 |
| 201 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleWebContentsObserverBridge); | 205 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleWebContentsObserverBridge); |
| 202 }; | 206 }; |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 | 913 |
| 910 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { | 914 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { |
| 911 return &mediaMenus_; | 915 return &mediaMenus_; |
| 912 } | 916 } |
| 913 | 917 |
| 914 - (LocationBarDecoration*)decorationForBubble { | 918 - (LocationBarDecoration*)decorationForBubble { |
| 915 return decoration_; | 919 return decoration_; |
| 916 } | 920 } |
| 917 | 921 |
| 918 @end // ContentSettingBubbleController | 922 @end // ContentSettingBubbleController |
| OLD | NEW |