OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #include "chrome/browser/tab_contents/provisional_load_details.h" | 78 #include "chrome/browser/tab_contents/provisional_load_details.h" |
79 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 79 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
80 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 80 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
81 #include "chrome/browser/tab_contents/tab_contents_view.h" | 81 #include "chrome/browser/tab_contents/tab_contents_view.h" |
82 #include "chrome/browser/tab_contents/web_navigation_observer.h" | 82 #include "chrome/browser/tab_contents/web_navigation_observer.h" |
83 #include "chrome/browser/translate/page_translated_details.h" | 83 #include "chrome/browser/translate/page_translated_details.h" |
84 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 84 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
85 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 85 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
86 #include "chrome/common/bindings_policy.h" | 86 #include "chrome/common/bindings_policy.h" |
87 #include "chrome/common/chrome_switches.h" | 87 #include "chrome/common/chrome_switches.h" |
88 #include "chrome/common/content_restriction.h" | |
89 #include "chrome/common/extensions/extension.h" | 88 #include "chrome/common/extensions/extension.h" |
90 #include "chrome/common/extensions/extension_action.h" | 89 #include "chrome/common/extensions/extension_action.h" |
91 #include "chrome/common/extensions/extension_icon_set.h" | 90 #include "chrome/common/extensions/extension_icon_set.h" |
92 #include "chrome/common/extensions/extension_resource.h" | 91 #include "chrome/common/extensions/extension_resource.h" |
93 #include "chrome/common/extensions/url_pattern.h" | 92 #include "chrome/common/extensions/url_pattern.h" |
94 #include "chrome/common/navigation_types.h" | 93 #include "chrome/common/navigation_types.h" |
95 #include "chrome/common/net/url_request_context_getter.h" | 94 #include "chrome/common/net/url_request_context_getter.h" |
96 #include "chrome/common/notification_service.h" | 95 #include "chrome/common/notification_service.h" |
97 #include "chrome/common/pref_names.h" | 96 #include "chrome/common/pref_names.h" |
98 #include "chrome/common/render_messages.h" | 97 #include "chrome/common/render_messages.h" |
(...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 } | 2638 } |
2640 | 2639 |
2641 void TabContents::RequestMove(const gfx::Rect& new_bounds) { | 2640 void TabContents::RequestMove(const gfx::Rect& new_bounds) { |
2642 if (delegate() && delegate()->IsPopup(this)) | 2641 if (delegate() && delegate()->IsPopup(this)) |
2643 delegate()->MoveContents(this, new_bounds); | 2642 delegate()->MoveContents(this, new_bounds); |
2644 } | 2643 } |
2645 | 2644 |
2646 void TabContents::DidStartLoading() { | 2645 void TabContents::DidStartLoading() { |
2647 SetIsLoading(true, NULL); | 2646 SetIsLoading(true, NULL); |
2648 | 2647 |
2649 if (delegate()) { | 2648 if (content_restrictions_) { |
2650 bool is_print_preview_tab = | 2649 content_restrictions_= 0; |
2651 printing::PrintPreviewTabController::IsPrintPreviewTab(this); | 2650 delegate()->ContentRestrictionsChanged(this); |
2652 if (content_restrictions_ || is_print_preview_tab) { | |
2653 content_restrictions_= is_print_preview_tab ? | |
2654 CONTENT_RESTRICTION_PRINT : 0; | |
2655 delegate()->ContentRestrictionsChanged(this); | |
2656 } | |
2657 } | 2651 } |
2658 | 2652 |
2659 // Notify observers about navigation. | 2653 // Notify observers about navigation. |
2660 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_, | 2654 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_, |
2661 DidStartLoading()); | 2655 DidStartLoading()); |
2662 } | 2656 } |
2663 | 2657 |
2664 void TabContents::DidStopLoading() { | 2658 void TabContents::DidStopLoading() { |
2665 scoped_ptr<LoadNotificationDetails> details; | 2659 scoped_ptr<LoadNotificationDetails> details; |
2666 | 2660 |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3242 } | 3236 } |
3243 | 3237 |
3244 void TabContents::set_encoding(const std::string& encoding) { | 3238 void TabContents::set_encoding(const std::string& encoding) { |
3245 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 3239 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
3246 } | 3240 } |
3247 | 3241 |
3248 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 3242 void TabContents::SetAppIcon(const SkBitmap& app_icon) { |
3249 app_icon_ = app_icon; | 3243 app_icon_ = app_icon; |
3250 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 3244 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
3251 } | 3245 } |
OLD | NEW |