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

Unified Diff: chrome/browser/bookmarks/bookmark_utils.cc

Issue 10692164: Remove browser::FindTabbedBrowser call in bookmark_utils.cc. All callers, with the exception of met… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/bookmarks/bookmark_utils.cc
===================================================================
--- chrome/browser/bookmarks/bookmark_utils.cc (revision 146039)
+++ chrome/browser/bookmarks/bookmark_utils.cc (working copy)
@@ -21,12 +21,9 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/common/pref_names.h"
-#include "content/public/browser/page_navigator.h"
#include "content/public/browser/web_contents.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -59,41 +56,6 @@
namespace {
-// A PageNavigator implementation that creates a new Browser. This is used when
-// opening a url and there is no Browser open. The Browser is created the first
-// time the PageNavigator method is invoked.
-class NewBrowserPageNavigator : public PageNavigator {
- public:
- explicit NewBrowserPageNavigator(Profile* profile)
- : profile_(profile),
- browser_(NULL) {}
-
- virtual ~NewBrowserPageNavigator() {
- if (browser_)
- browser_->window()->Show();
- }
-
- Browser* browser() const { return browser_; }
-
- virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE {
- if (!browser_) {
- Profile* profile = (params.disposition == OFF_THE_RECORD) ?
- profile_->GetOffTheRecordProfile() : profile_;
- browser_ = Browser::Create(profile);
- }
-
- OpenURLParams forward_params = params;
- forward_params.disposition = NEW_FOREGROUND_TAB;
- return browser_->OpenURL(forward_params);
- }
-
- private:
- Profile* profile_;
- Browser* browser_;
-
- DISALLOW_COPY_AND_ASSIGN(NewBrowserPageNavigator);
-};
-
void CloneBookmarkNodeImpl(BookmarkModel* model,
const BookmarkNodeData::Element& element,
const BookmarkNode* parent,
@@ -377,40 +339,24 @@
}
void OpenAll(gfx::NativeWindow parent,
- Profile* profile,
PageNavigator* navigator,
const std::vector<const BookmarkNode*>& nodes,
WindowOpenDisposition initial_disposition) {
if (!ShouldOpenAll(parent, nodes))
return;
- NewBrowserPageNavigator navigator_impl(profile);
- if (!navigator) {
- Browser* browser = browser::FindTabbedBrowser(profile, false);
- if (!browser || !chrome::GetActiveWebContents(browser)) {
- navigator = &navigator_impl;
- } else {
- if (initial_disposition != NEW_WINDOW &&
- initial_disposition != OFF_THE_RECORD) {
- browser->window()->Activate();
- }
- navigator = chrome::GetActiveWebContents(browser);
- }
- }
-
bool opened_url = false;
for (size_t i = 0; i < nodes.size(); ++i)
OpenAllImpl(nodes[i], initial_disposition, &navigator, &opened_url);
}
void OpenAll(gfx::NativeWindow parent,
- Profile* profile,
PageNavigator* navigator,
const BookmarkNode* node,
WindowOpenDisposition initial_disposition) {
std::vector<const BookmarkNode*> nodes;
nodes.push_back(node);
- OpenAll(parent, profile, navigator, nodes, initial_disposition);
+ OpenAll(parent, navigator, nodes, initial_disposition);
}
void CopyToClipboard(BookmarkModel* model,
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.h ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698