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

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

Issue 5320001: Disable printing context menus on the print preview page. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix test in a less hacky manner Created 10 years 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
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
88 #include "chrome/common/extensions/extension.h" 89 #include "chrome/common/extensions/extension.h"
89 #include "chrome/common/extensions/extension_action.h" 90 #include "chrome/common/extensions/extension_action.h"
90 #include "chrome/common/extensions/extension_icon_set.h" 91 #include "chrome/common/extensions/extension_icon_set.h"
91 #include "chrome/common/extensions/extension_resource.h" 92 #include "chrome/common/extensions/extension_resource.h"
92 #include "chrome/common/extensions/url_pattern.h" 93 #include "chrome/common/extensions/url_pattern.h"
93 #include "chrome/common/navigation_types.h" 94 #include "chrome/common/navigation_types.h"
94 #include "chrome/common/net/url_request_context_getter.h" 95 #include "chrome/common/net/url_request_context_getter.h"
95 #include "chrome/common/notification_service.h" 96 #include "chrome/common/notification_service.h"
96 #include "chrome/common/pref_names.h" 97 #include "chrome/common/pref_names.h"
97 #include "chrome/common/render_messages.h" 98 #include "chrome/common/render_messages.h"
(...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 } 2639 }
2639 2640
2640 void TabContents::RequestMove(const gfx::Rect& new_bounds) { 2641 void TabContents::RequestMove(const gfx::Rect& new_bounds) {
2641 if (delegate() && delegate()->IsPopup(this)) 2642 if (delegate() && delegate()->IsPopup(this))
2642 delegate()->MoveContents(this, new_bounds); 2643 delegate()->MoveContents(this, new_bounds);
2643 } 2644 }
2644 2645
2645 void TabContents::DidStartLoading() { 2646 void TabContents::DidStartLoading() {
2646 SetIsLoading(true, NULL); 2647 SetIsLoading(true, NULL);
2647 2648
2648 if (content_restrictions_) { 2649 if (delegate()) {
2649 content_restrictions_= 0; 2650 bool is_print_preview_tab =
2650 delegate()->ContentRestrictionsChanged(this); 2651 printing::PrintPreviewTabController::IsPrintPreviewTab(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 }
2651 } 2657 }
2652 2658
2653 // Notify observers about navigation. 2659 // Notify observers about navigation.
2654 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_, 2660 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
2655 DidStartLoading()); 2661 DidStartLoading());
2656 } 2662 }
2657 2663
2658 void TabContents::DidStopLoading() { 2664 void TabContents::DidStopLoading() {
2659 scoped_ptr<LoadNotificationDetails> details; 2665 scoped_ptr<LoadNotificationDetails> details;
2660 2666
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
3236 } 3242 }
3237 3243
3238 void TabContents::set_encoding(const std::string& encoding) { 3244 void TabContents::set_encoding(const std::string& encoding) {
3239 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); 3245 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
3240 } 3246 }
3241 3247
3242 void TabContents::SetAppIcon(const SkBitmap& app_icon) { 3248 void TabContents::SetAppIcon(const SkBitmap& app_icon) {
3243 app_icon_ = app_icon; 3249 app_icon_ = app_icon;
3244 NotifyNavigationStateChanged(INVALIDATE_TITLE); 3250 NotifyNavigationStateChanged(INVALIDATE_TITLE);
3245 } 3251 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698