OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/active_downloads_ui.h" | 5 #include "chrome/browser/ui/webui/active_downloads_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 return false; | 296 return false; |
297 } | 297 } |
298 | 298 |
299 void ActiveDownloadsHandler::OpenNewFullWindow(const ListValue* args) { | 299 void ActiveDownloadsHandler::OpenNewFullWindow(const ListValue* args) { |
300 std::string url = UTF16ToUTF8(ExtractStringValue(args)); | 300 std::string url = UTF16ToUTF8(ExtractStringValue(args)); |
301 | 301 |
302 if (SelectTab(GURL(url))) | 302 if (SelectTab(GURL(url))) |
303 return; | 303 return; |
304 | 304 |
305 Browser* browser = BrowserList::GetLastActive(); | 305 Browser* browser = BrowserList::GetLastActive(); |
306 browser::NavigateParams params(browser, GURL(url), PageTransition::LINK); | 306 browser::NavigateParams params( |
| 307 browser, GURL(url), content::PAGE_TRANSITION_LINK); |
307 params.disposition = NEW_FOREGROUND_TAB; | 308 params.disposition = NEW_FOREGROUND_TAB; |
308 browser::Navigate(¶ms); | 309 browser::Navigate(¶ms); |
309 browser->window()->Show(); | 310 browser->window()->Show(); |
310 } | 311 } |
311 | 312 |
312 void ActiveDownloadsHandler::ModelChanged() { | 313 void ActiveDownloadsHandler::ModelChanged() { |
313 UpdateDownloadList(); | 314 UpdateDownloadList(); |
314 } | 315 } |
315 | 316 |
316 void ActiveDownloadsHandler::HandleGetDownloads(const ListValue* args) { | 317 void ActiveDownloadsHandler::HandleGetDownloads(const ListValue* args) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 396 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
396 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 397 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
397 } | 398 } |
398 | 399 |
399 #if defined(TOUCH_UI) | 400 #if defined(TOUCH_UI) |
400 | 401 |
401 // static | 402 // static |
402 TabContents* ActiveDownloadsUI::OpenPopup(Profile* profile) { | 403 TabContents* ActiveDownloadsUI::OpenPopup(Profile* profile) { |
403 Browser* browser = Browser::GetOrCreateTabbedBrowser(profile); | 404 Browser* browser = Browser::GetOrCreateTabbedBrowser(profile); |
404 OpenURLParams params(GURL(chrome::kChromeUIActiveDownloadsURL), GURL(), | 405 OpenURLParams params(GURL(chrome::kChromeUIActiveDownloadsURL), GURL(), |
405 SINGLETON_TAB, PageTransition::LINK); | 406 SINGLETON_TAB, content::PAGE_TRANSITION_LINK); |
406 TabContents* download_contents = browser->OpenURL(params); | 407 TabContents* download_contents = browser->OpenURL(params); |
407 browser->window()->Show(); | 408 browser->window()->Show(); |
408 return download_contents; | 409 return download_contents; |
409 } | 410 } |
410 | 411 |
411 TabContents* ActiveDownloadsUI::GetPopup(Browser** browser) { | 412 TabContents* ActiveDownloadsUI::GetPopup(Browser** browser) { |
412 for (TabContentsIterator it; !it.done(); ++it) { | 413 for (TabContentsIterator it; !it.done(); ++it) { |
413 TabContents* tab = it->tab_contents(); | 414 TabContents* tab = it->tab_contents(); |
414 const GURL& url = tab->GetURL(); | 415 const GURL& url = tab->GetURL(); |
415 if (url.SchemeIs(chrome::kChromeUIScheme) && | 416 if (url.SchemeIs(chrome::kChromeUIScheme) && |
(...skipping 12 matching lines...) Expand all Loading... |
428 Browser* browser = GetPopup(); | 429 Browser* browser = GetPopup(); |
429 | 430 |
430 // Create new browser if no matching pop up is found. | 431 // Create new browser if no matching pop up is found. |
431 if (browser == NULL) { | 432 if (browser == NULL) { |
432 browser = Browser::CreateForApp(Browser::TYPE_PANEL, kActiveDownloadAppName, | 433 browser = Browser::CreateForApp(Browser::TYPE_PANEL, kActiveDownloadAppName, |
433 gfx::Rect(), profile); | 434 gfx::Rect(), profile); |
434 | 435 |
435 browser::NavigateParams params( | 436 browser::NavigateParams params( |
436 browser, | 437 browser, |
437 GURL(chrome::kChromeUIActiveDownloadsURL), | 438 GURL(chrome::kChromeUIActiveDownloadsURL), |
438 PageTransition::LINK); | 439 content::PAGE_TRANSITION_LINK); |
439 params.disposition = NEW_FOREGROUND_TAB; | 440 params.disposition = NEW_FOREGROUND_TAB; |
440 browser::Navigate(¶ms); | 441 browser::Navigate(¶ms); |
441 | 442 |
442 DCHECK_EQ(browser, params.browser); | 443 DCHECK_EQ(browser, params.browser); |
443 // TODO(beng): The following two calls should be automatic by Navigate(). | 444 // TODO(beng): The following two calls should be automatic by Navigate(). |
444 browser->window()->SetBounds(gfx::Rect(kPopupLeft, | 445 browser->window()->SetBounds(gfx::Rect(kPopupLeft, |
445 kPopupTop, | 446 kPopupTop, |
446 kPopupWidth, | 447 kPopupWidth, |
447 kPopupHeight)); | 448 kPopupHeight)); |
448 } | 449 } |
(...skipping 19 matching lines...) Expand all Loading... |
468 } | 469 } |
469 } | 470 } |
470 } | 471 } |
471 return NULL; | 472 return NULL; |
472 } | 473 } |
473 #endif // defined(TOUCH_UI) | 474 #endif // defined(TOUCH_UI) |
474 | 475 |
475 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { | 476 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { |
476 return handler_->downloads(); | 477 return handler_->downloads(); |
477 } | 478 } |
OLD | NEW |