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

Side by Side Diff: chrome/browser/dom_ui/filebrowse_ui.cc

Issue 3834002: Make all browser code use browser::Navigate to open tabs.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
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/dom_ui/filebrowse_ui.h" 5 #include "chrome/browser/dom_ui/filebrowse_ui.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/singleton.h" 13 #include "base/singleton.h"
14 #include "base/string_piece.h" 14 #include "base/string_piece.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/thread.h" 16 #include "base/thread.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "base/weak_ptr.h" 20 #include "base/weak_ptr.h"
21 #include "chrome/browser/bookmarks/bookmark_model.h" 21 #include "chrome/browser/bookmarks/bookmark_model.h"
22 #include "chrome/browser/browser.h" 22 #include "chrome/browser/browser.h"
23 #include "chrome/browser/browser_list.h" 23 #include "chrome/browser/browser_list.h"
24 #include "chrome/browser/browser_navigator.h"
24 #include "chrome/browser/browser_thread.h" 25 #include "chrome/browser/browser_thread.h"
25 #include "chrome/browser/browser_window.h" 26 #include "chrome/browser/browser_window.h"
26 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h" 27 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h"
27 #include "chrome/browser/dom_ui/mediaplayer_ui.h" 28 #include "chrome/browser/dom_ui/mediaplayer_ui.h"
28 #include "chrome/browser/download/download_item.h" 29 #include "chrome/browser/download/download_item.h"
29 #include "chrome/browser/download/download_manager.h" 30 #include "chrome/browser/download/download_manager.h"
30 #include "chrome/browser/download/download_util.h" 31 #include "chrome/browser/download/download_util.h"
31 #include "chrome/browser/history/history_types.h" 32 #include "chrome/browser/history/history_types.h"
32 #include "chrome/browser/metrics/user_metrics.h" 33 #include "chrome/browser/metrics/user_metrics.h"
33 #include "chrome/browser/prefs/pref_service.h" 34 #include "chrome/browser/prefs/pref_service.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 690
690 void FilebrowseHandler::OpenNewPopupWindow(const ListValue* args) { 691 void FilebrowseHandler::OpenNewPopupWindow(const ListValue* args) {
691 OpenNewWindow(args, true); 692 OpenNewWindow(args, true);
692 } 693 }
693 694
694 void FilebrowseHandler::OpenNewWindow(const ListValue* args, bool popup) { 695 void FilebrowseHandler::OpenNewWindow(const ListValue* args, bool popup) {
695 std::string url = WideToUTF8(ExtractStringValue(args)); 696 std::string url = WideToUTF8(ExtractStringValue(args));
696 Browser* browser = popup ? 697 Browser* browser = popup ?
697 Browser::CreateForType(Browser::TYPE_APP_PANEL, profile_) : 698 Browser::CreateForType(Browser::TYPE_APP_PANEL, profile_) :
698 BrowserList::GetLastActive(); 699 BrowserList::GetLastActive();
699 Browser::AddTabWithURLParams params(GURL(url), PageTransition::LINK); 700 browser::NavigateParams params(browser, GURL(url), PageTransition::LINK);
700 browser->AddTabWithURL(&params); 701 params.disposition = NEW_FOREGROUND_TAB;
702 browser::Navigate(&params);
703 // TODO(beng): The following two calls should be automatic by Navigate().
701 if (popup) { 704 if (popup) {
702 // TODO(dhg): Remove these from being hardcoded. Allow javascript 705 // TODO(dhg): Remove these from being hardcoded. Allow javascript
703 // to specify. 706 // to specify.
704 params.target->window()->SetBounds(gfx::Rect(0, 0, 400, 300)); 707 params.browser->window()->SetBounds(gfx::Rect(0, 0, 400, 300));
705 } 708 }
706 params.target->window()->Show(); 709 params.browser->window()->Show();
707 } 710 }
708 711
709 void FilebrowseHandler::SendPicasawebRequest() { 712 void FilebrowseHandler::SendPicasawebRequest() {
710 #if defined(OS_CHROMEOS) 713 #if defined(OS_CHROMEOS)
711 chromeos::UserManager* user_man = chromeos::UserManager::Get(); 714 chromeos::UserManager* user_man = chromeos::UserManager::Get();
712 std::string username = user_man->logged_in_user().email(); 715 std::string username = user_man->logged_in_user().email();
713 716
714 if (username.empty()) { 717 if (username.empty()) {
715 LOG(ERROR) << "Unable to get username"; 718 LOG(ERROR) << "Unable to get username";
716 return; 719 return;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 if (browser == NULL) { 1057 if (browser == NULL) {
1055 browser = Browser::CreateForType(Browser::TYPE_APP_PANEL, profile); 1058 browser = Browser::CreateForType(Browser::TYPE_APP_PANEL, profile);
1056 std::string url; 1059 std::string url;
1057 if (hashArgument.empty()) { 1060 if (hashArgument.empty()) {
1058 url = chrome::kChromeUIFileBrowseURL; 1061 url = chrome::kChromeUIFileBrowseURL;
1059 } else { 1062 } else {
1060 url = kFilebrowseURLHash; 1063 url = kFilebrowseURLHash;
1061 url.append(hashArgument); 1064 url.append(hashArgument);
1062 } 1065 }
1063 1066
1064 Browser::AddTabWithURLParams params(GURL(url), PageTransition::LINK); 1067 browser::NavigateParams params(browser, GURL(url), PageTransition::LINK);
1065 browser->AddTabWithURL(&params); 1068 params.disposition = NEW_FOREGROUND_TAB;
1066 params.target->window()->SetBounds(gfx::Rect(kPopupLeft, 1069 browser::Navigate(&params);
1067 kPopupTop, 1070 // TODO(beng): The following two calls should be automatic by Navigate().
1068 width, 1071 params.browser->window()->SetBounds(gfx::Rect(kPopupLeft,
1069 height)); 1072 kPopupTop,
1073 width,
1074 height));
1070 1075
1071 params.target->window()->Show(); 1076 params.browser->window()->Show();
1072 } else { 1077 } else {
1073 browser->window()->Show(); 1078 browser->window()->Show();
1074 } 1079 }
1075 1080
1076 return browser; 1081 return browser;
1077 } 1082 }
1078 1083
1079 Browser* FileBrowseUI::GetPopupForPath(const std::string& path, 1084 Browser* FileBrowseUI::GetPopupForPath(const std::string& path,
1080 Profile* profile) { 1085 Profile* profile) {
1081 std::string current_path = path; 1086 std::string current_path = path;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 } 1121 }
1117 } 1122 }
1118 1123
1119 return NULL; 1124 return NULL;
1120 } 1125 }
1121 1126
1122 const int FileBrowseUI::kPopupWidth = 250; 1127 const int FileBrowseUI::kPopupWidth = 250;
1123 const int FileBrowseUI::kPopupHeight = 300; 1128 const int FileBrowseUI::kPopupHeight = 300;
1124 const int FileBrowseUI::kSmallPopupWidth = 250; 1129 const int FileBrowseUI::kSmallPopupWidth = 250;
1125 const int FileBrowseUI::kSmallPopupHeight = 50; 1130 const int FileBrowseUI::kSmallPopupHeight = 50;
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tab_strip_controller.mm ('k') | chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698