OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 } else { | 744 } else { |
745 LOG(ERROR) << "Unable to get string"; | 745 LOG(ERROR) << "Unable to get string"; |
746 return; | 746 return; |
747 } | 747 } |
748 Browser* browser; | 748 Browser* browser; |
749 if (popup) { | 749 if (popup) { |
750 browser = Browser::CreateForType(Browser::TYPE_APP_PANEL, profile_); | 750 browser = Browser::CreateForType(Browser::TYPE_APP_PANEL, profile_); |
751 } else { | 751 } else { |
752 browser = BrowserList::GetLastActive(); | 752 browser = BrowserList::GetLastActive(); |
753 } | 753 } |
754 TabContents* contents = browser->AddTabWithURL( | 754 browser->AddTabWithURL(GURL(path), GURL(), PageTransition::LINK, -1, |
755 GURL(path), GURL(), PageTransition::LINK, -1, | 755 TabStripModel::ADD_SELECTED, NULL, std::string(), |
756 TabStripModel::ADD_SELECTED, NULL, std::string()); | 756 &browser); |
757 // AddTabWithURL could have picked another Browser instance to create this | |
758 // new tab at. So we have to reset the ptr of the browser that we want to | |
759 // talk to. | |
760 browser = contents->delegate()->GetBrowser(); | |
761 if (popup) { | 757 if (popup) { |
762 // TODO(dhg): Remove these from being hardcoded. Allow javascript | 758 // TODO(dhg): Remove these from being hardcoded. Allow javascript |
763 // to specify. | 759 // to specify. |
764 browser->window()->SetBounds(gfx::Rect(0, 0, 400, 300)); | 760 browser->window()->SetBounds(gfx::Rect(0, 0, 400, 300)); |
765 } | 761 } |
766 browser->window()->Show(); | 762 browser->window()->Show(); |
767 } else { | 763 } else { |
768 LOG(ERROR) << "Wasn't able to get the List if requested files."; | 764 LOG(ERROR) << "Wasn't able to get the List if requested files."; |
769 return; | 765 return; |
770 } | 766 } |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 std::string url; | 1109 std::string url; |
1114 if (hashArgument.empty()) { | 1110 if (hashArgument.empty()) { |
1115 url = chrome::kChromeUIFileBrowseURL; | 1111 url = chrome::kChromeUIFileBrowseURL; |
1116 } else { | 1112 } else { |
1117 url = kFilebrowseURLHash; | 1113 url = kFilebrowseURLHash; |
1118 url.append(hashArgument); | 1114 url.append(hashArgument); |
1119 } | 1115 } |
1120 | 1116 |
1121 browser->AddTabWithURL( | 1117 browser->AddTabWithURL( |
1122 GURL(url), GURL(), PageTransition::LINK, -1, | 1118 GURL(url), GURL(), PageTransition::LINK, -1, |
1123 TabStripModel::ADD_SELECTED, NULL, std::string()); | 1119 TabStripModel::ADD_SELECTED, NULL, std::string(), |
| 1120 &browser); |
1124 browser->window()->SetBounds(gfx::Rect(kPopupLeft, | 1121 browser->window()->SetBounds(gfx::Rect(kPopupLeft, |
1125 kPopupTop, | 1122 kPopupTop, |
1126 width, | 1123 width, |
1127 height)); | 1124 height)); |
1128 | 1125 |
1129 browser->window()->Show(); | 1126 browser->window()->Show(); |
1130 } else { | 1127 } else { |
1131 browser->window()->Show(); | 1128 browser->window()->Show(); |
1132 } | 1129 } |
1133 | 1130 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 } | 1165 } |
1169 } | 1166 } |
1170 | 1167 |
1171 return NULL; | 1168 return NULL; |
1172 } | 1169 } |
1173 | 1170 |
1174 const int FileBrowseUI::kPopupWidth = 250; | 1171 const int FileBrowseUI::kPopupWidth = 250; |
1175 const int FileBrowseUI::kPopupHeight = 300; | 1172 const int FileBrowseUI::kPopupHeight = 300; |
1176 const int FileBrowseUI::kSmallPopupWidth = 250; | 1173 const int FileBrowseUI::kSmallPopupWidth = 250; |
1177 const int FileBrowseUI::kSmallPopupHeight = 50; | 1174 const int FileBrowseUI::kSmallPopupHeight = 50; |
OLD | NEW |