0

Try to cut down Browser/TabContents header dependencies.

- Forward declare printing::PrintViewManager in TabContents
- tab_contents.h shouldn't depend on autocomplete_edit.h
- Pull logging out of Browser through PageTransitionTypes

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/2934004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51995 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
erg@chromium.org
2010-07-09 19:43:09 +00:00
parent 652727def5
commit 1280270eea
16 changed files with 42 additions and 23 deletions

@ -34,6 +34,7 @@
#include "chrome/browser/automation/automation_provider_list.h"
#include "chrome/browser/automation/automation_provider_observers.h"
#include "chrome/browser/automation/extension_port_container.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/blocked_popup_container.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_storage.h"

@ -12,7 +12,6 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/pref_member.h"
#include "chrome/browser/sessions/session_id.h"

@ -14,6 +14,7 @@
#include "chrome/common/notification_type.h"
#include "gfx/size.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
class ImageLoadingTrackerTest : public testing::Test,
public ImageLoadingTracker::Observer {

@ -6,6 +6,7 @@
#include <limits>
#include "base/logging.h"
#include "base/stl_util-inl.h"
using base::Time;

@ -11,6 +11,7 @@
#include "app/sql/connection.h"
#include "app/sql/statement.h"
#include "base/logging.h"
#include "chrome/browser/history/url_database.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/url_constants.h"

@ -9,6 +9,7 @@
#include "app/resource_bundle.h"
#include "base/command_line.h"
#include "base/task.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"

@ -10,6 +10,7 @@
#include "chrome/common/dom_storage_common.h"
#include "chrome/common/render_messages.h"
#include "gfx/rect.h"
#include "webkit/glue/webpreferences.h"
using webkit_glue::PasswordForm;

@ -15,6 +15,7 @@
#include "base/string_util.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/debugger/devtools_manager.h"

@ -53,6 +53,7 @@
#include "chrome/browser/platform_util.h"
#include "chrome/browser/plugin_installer.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@ -77,6 +78,9 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/navigation_types.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
@ -248,7 +252,8 @@ TabContents::TabContents(Profile* profile,
ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)),
property_bag_(),
registrar_(),
ALLOW_THIS_IN_INITIALIZER_LIST(printing_(*this)),
ALLOW_THIS_IN_INITIALIZER_LIST(printing_(
new printing::PrintViewManager(*this))),
save_package_(),
autocomplete_history_manager_(),
autofill_manager_(),
@ -827,7 +832,7 @@ bool TabContents::NavigateToPendingEntry(
void TabContents::Stop() {
render_manager_.Stop();
printing_.Stop();
printing_->Stop();
}
void TabContents::DisassociateFromPopupCount() {
@ -2143,7 +2148,7 @@ RenderViewHostDelegate::Save* TabContents::GetSaveDelegate() {
}
RenderViewHostDelegate::Printing* TabContents::GetPrintingDelegate() {
return &printing_;
return printing_.get();
}
RenderViewHostDelegate::FavIcon* TabContents::GetFavIconDelegate() {
@ -2237,7 +2242,7 @@ void TabContents::RenderViewReady(RenderViewHost* rvh) {
void TabContents::RenderViewGone(RenderViewHost* rvh) {
// Ask the print preview if this renderer was valuable.
if (!printing_.OnRenderViewGone(rvh))
if (!printing_->OnRenderViewGone(rvh))
return;
if (rvh != render_view_host()) {
// The pending page's RenderViewHost is gone.

@ -16,7 +16,6 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/dom_ui/dom_ui_factory.h"
#include "chrome/browser/download/save_package.h"
@ -26,7 +25,6 @@
#include "chrome/browser/find_notification_details.h"
#include "chrome/browser/jsmessage_box_client.h"
#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/tab_contents/constrained_window.h"
@ -37,9 +35,6 @@
#include "chrome/browser/tab_contents/page_navigator.h"
#include "chrome/browser/tab_contents/render_view_host_manager.h"
#include "chrome/browser/tab_contents/tab_specific_content_settings.h"
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/navigation_types.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/property_bag.h"
#include "chrome/common/renderer_preferences.h"
@ -49,7 +44,6 @@
#include "net/base/load_states.h"
#include "webkit/glue/dom_operations.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/webpreferences.h"
namespace gfx {
class Rect;
@ -64,6 +58,9 @@ namespace base {
class WaitableEvent;
}
namespace printing {
class PrintViewManager;
}
namespace IPC {
class Message;
@ -88,10 +85,13 @@ class TabContents;
class TabContentsDelegate;
class TabContentsFactory;
class TabContentsView;
class URLPattern;
class URLRequestContextGetter;
struct ThumbnailScore;
struct ViewHostMsg_DidPrintPage_Params;
struct ViewHostMsg_FrameNavigate_Params;
struct ViewHostMsg_RunFileChooser_Params;
struct WebPreferences;
// Describes what goes in the main content area of a tab. TabContents is
// the only type of TabContents, and these should be merged together.
@ -1054,7 +1054,7 @@ class TabContents : public PageNavigator,
NotificationRegistrar registrar_;
// Handles print preview and print job for this contents.
printing::PrintViewManager printing_;
scoped_ptr<printing::PrintViewManager> printing_;
// SavePackage, lazily created.
scoped_refptr<SavePackage> save_package_;

@ -8,6 +8,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_registrar.h"
#include "webkit/glue/webpreferences.h"
class RenderViewHostFactory;
class TestRenderViewHost;

@ -5,6 +5,7 @@
#include "chrome/browser/toolbar_model.h"
#include "app/l10n_util.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/cert_store.h"
#include "chrome/browser/pref_service.h"

@ -33,6 +33,7 @@
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "webkit/glue/image_decoder.h"
#if defined(OS_WIN)

@ -20,10 +20,10 @@
#include "gfx/size.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
#include "third_party/skia/include/core/SkBitmap.h"
class ExtensionAction;
class ExtensionResource;
class SkBitmap;
// Represents a Chrome extension.
class Extension {

@ -4,6 +4,20 @@
#include "chrome/common/page_transition_types.h"
#include "base/logging.h"
// static
PageTransition::Type PageTransition::FromInt(int32 type) {
if (!ValidType(type)) {
NOTREACHED() << "Invalid transition type " << type;
// Return a safe default so we don't have corrupt data in release mode.
return LINK;
}
return static_cast<Type>(type);
}
// static
const char* PageTransition::CoreTransitionString(Type type) {
switch (type & PageTransition::CORE_MASK) {
case 0: return "link";

@ -6,7 +6,6 @@
#define CHROME_COMMON_PAGE_TRANSITION_TYPES_H__
#include "base/basictypes.h"
#include "base/logging.h"
// This class is for scoping only.
class PageTransition {
@ -131,15 +130,7 @@ class PageTransition {
return (t <= LAST_CORE);
}
static Type FromInt(int32 type) {
if (!ValidType(type)) {
NOTREACHED() << "Invalid transition type " << type;
// Return a safe default so we don't have corrupt data in release mode.
return LINK;
}
return static_cast<Type>(type);
}
static Type FromInt(int32 type);
// Returns true if the given transition is a top-level frame transition, or
// false if the transition was for a subframe.