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/location_bar/content_setting_decoration.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" | 13 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" |
14 #include "chrome/browser/ui/browser_dialogs.h" | |
15 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/cocoa/browser_dialogs_views_mac.h" |
16 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" | 16 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
| 17 #import "chrome/browser/ui/cocoa/l10n_util.h" |
17 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 18 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
18 #import "chrome/browser/ui/cocoa/l10n_util.h" | |
19 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 19 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
20 #import "chrome/browser/ui/cocoa/themed_window.h" | 20 #import "chrome/browser/ui/cocoa/themed_window.h" |
21 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 21 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
22 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 22 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
23 #include "chrome/grit/theme_resources.h" | 23 #include "chrome/grit/theme_resources.h" |
24 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "skia/ext/skia_utils_mac.h" | 26 #include "skia/ext/skia_utils_mac.h" |
27 #include "ui/base/cocoa/appkit_utils.h" | 27 #include "ui/base/cocoa/appkit_utils.h" |
28 #include "ui/base/cocoa/cocoa_base_utils.h" | 28 #include "ui/base/cocoa/cocoa_base_utils.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // Open bubble. | 299 // Open bubble. |
300 ContentSettingBubbleModel* model = | 300 ContentSettingBubbleModel* model = |
301 content_setting_image_model_->CreateBubbleModel( | 301 content_setting_image_model_->CreateBubbleModel( |
302 browser->content_setting_bubble_model_delegate(), | 302 browser->content_setting_bubble_model_delegate(), |
303 web_contents, | 303 web_contents, |
304 profile_); | 304 profile_); |
305 | 305 |
306 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 306 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
307 gfx::Point origin = gfx::ScreenPointFromNSPoint(anchor); | 307 gfx::Point origin = gfx::ScreenPointFromNSPoint(anchor); |
308 chrome::ContentSettingBubbleViewsBridge::Show( | 308 chrome::ContentSettingBubbleViewsBridge::Show( |
309 [web_contents->GetTopLevelNativeWindow() contentView], | 309 [web_contents->GetTopLevelNativeWindow() contentView], model, |
310 model, web_contents, origin); | 310 web_contents, origin, this); |
311 } else { | 311 } else { |
312 // If the bubble is already opened, close it. Otherwise, open a new bubble. | 312 // If the bubble is already opened, close it. Otherwise, open a new bubble. |
313 if (bubbleWindow_ && [bubbleWindow_ isVisible]) { | 313 if (bubbleWindow_ && [bubbleWindow_ isVisible]) { |
314 [bubbleWindow_ close]; | 314 [bubbleWindow_ close]; |
315 bubbleWindow_.reset(); | 315 bubbleWindow_.reset(); |
316 } else { | 316 } else { |
317 ContentSettingBubbleController* bubbleController = | 317 ContentSettingBubbleController* bubbleController = |
318 [ContentSettingBubbleController showForModel:model | 318 [ContentSettingBubbleController showForModel:model |
319 webContents:web_contents | 319 webContents:web_contents |
320 parentWindow:[field window] | 320 parentWindow:[field window] |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 438 } |
439 | 439 |
440 void ContentSettingDecoration::AnimationTimerFired() { | 440 void ContentSettingDecoration::AnimationTimerFired() { |
441 owner_->Layout(); | 441 owner_->Layout(); |
442 // Even after the animation completes, the |animator_| object should be kept | 442 // Even after the animation completes, the |animator_| object should be kept |
443 // alive to prevent the animation from re-appearing if the page opens | 443 // alive to prevent the animation from re-appearing if the page opens |
444 // additional popups later. The animator will be cleared when the decoration | 444 // additional popups later. The animator will be cleared when the decoration |
445 // hides, indicating something has changed with the WebContents (probably | 445 // hides, indicating something has changed with the WebContents (probably |
446 // navigation). | 446 // navigation). |
447 } | 447 } |
OLD | NEW |