summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/toolbar
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 02:15:25 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 02:15:25 +0000
commitdb6a876afe73ed1ad3befa04d0612527222ac168 (patch)
tree9b38fe9b3a85c8e90bdce18a0c5a163feb1788be /chrome/browser/ui/toolbar
parent1054bd6ea428148abc41de3285826edccb1244a5 (diff)
downloadchromium_src-db6a876afe73ed1ad3befa04d0612527222ac168.zip
chromium_src-db6a876afe73ed1ad3befa04d0612527222ac168.tar.gz
chromium_src-db6a876afe73ed1ad3befa04d0612527222ac168.tar.bz2
Revert 126959 - Re-factor location bar/toolbar code to get rid of the browser dependency. This CL is needed to allow code reusing by captive portal view, which will show web content using DomView.
BUG=chromium-os:22630 TEST=browser_tests,unit_tests works Review URL: http://codereview.chromium.org/9479008 TBR=altimofeev@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/toolbar')
-rw-r--r--chrome/browser/ui/toolbar/toolbar_model.cc12
-rw-r--r--chrome/browser/ui/toolbar/toolbar_model.h8
-rw-r--r--chrome/browser/ui/toolbar/toolbar_model_delegate.h23
3 files changed, 10 insertions, 33 deletions
diff --git a/chrome/browser/ui/toolbar/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc
index 23afe521..b769829 100644
--- a/chrome/browser/ui/toolbar/toolbar_model.cc
+++ b/chrome/browser/ui/toolbar/toolbar_model.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/ssl_error_info.h"
-#include "chrome/browser/ui/toolbar/toolbar_model_delegate.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -32,8 +32,8 @@ using content::NavigationEntry;
using content::SSLStatus;
using content::WebContents;
-ToolbarModel::ToolbarModel(ToolbarModelDelegate* delegate)
- : delegate_(delegate),
+ToolbarModel::ToolbarModel(Browser* browser)
+ : browser_(browser),
input_in_progress_(false) {
}
@@ -84,7 +84,7 @@ bool ToolbarModel::ShouldDisplayURL() const {
}
}
- WebContents* web_contents = delegate_->GetActiveWebContents();
+ WebContents* web_contents = browser_->GetSelectedWebContents();
if (web_contents && web_contents->GetWebUIForCurrentState())
return !web_contents->GetWebUIForCurrentState()->ShouldHideURL();
@@ -174,6 +174,6 @@ NavigationController* ToolbarModel::GetNavigationController() const {
// This |current_tab| can be NULL during the initialization of the
// toolbar during window creation (i.e. before any tabs have been added
// to the window).
- WebContents* current_tab = delegate_->GetActiveWebContents();
+ WebContents* current_tab = browser_->GetSelectedWebContents();
return current_tab ? &current_tab->GetController() : NULL;
}
diff --git a/chrome/browser/ui/toolbar/toolbar_model.h b/chrome/browser/ui/toolbar/toolbar_model.h
index e880348..e15fed6 100644
--- a/chrome/browser/ui/toolbar/toolbar_model.h
+++ b/chrome/browser/ui/toolbar/toolbar_model.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,7 @@
#include "base/basictypes.h"
#include "base/string16.h"
-class ToolbarModelDelegate;
+class Browser;
namespace content {
class NavigationController;
@@ -39,7 +39,7 @@ class ToolbarModel {
NUM_SECURITY_LEVELS,
};
- explicit ToolbarModel(ToolbarModelDelegate* delegate);
+ explicit ToolbarModel(Browser* browser);
~ToolbarModel();
// Returns the text that should be displayed in the location bar.
@@ -75,7 +75,7 @@ class ToolbarModel {
// If this returns NULL, default values are used.
content::NavigationController* GetNavigationController() const;
- ToolbarModelDelegate* delegate_;
+ Browser* browser_;
// Whether the text in the location bar is currently being edited.
bool input_in_progress_;
diff --git a/chrome/browser/ui/toolbar/toolbar_model_delegate.h b/chrome/browser/ui/toolbar/toolbar_model_delegate.h
deleted file mode 100644
index c45defb..0000000
--- a/chrome/browser/ui/toolbar/toolbar_model_delegate.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_H_
-#define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_H_
-#pragma once
-
-namespace content {
-class WebContents;
-}
-
-// Delegate which is used by ToolbarModel class.
-class ToolbarModelDelegate {
- public:
- // Returns active WebContents.
- virtual content::WebContents* GetActiveWebContents() const = 0;
-
- protected:
- virtual ~ToolbarModelDelegate() {}
-};
-
-#endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_H_