| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 Browser::~Browser() { | 464 Browser::~Browser() { |
| 465 // Stop observing notifications before continuing with destruction. Profile | 465 // Stop observing notifications before continuing with destruction. Profile |
| 466 // destruction will unload extensions and reentrant calls to Browser:: should | 466 // destruction will unload extensions and reentrant calls to Browser:: should |
| 467 // be avoided while it is being torn down. | 467 // be avoided while it is being torn down. |
| 468 registrar_.RemoveAll(); | 468 registrar_.RemoveAll(); |
| 469 extension_registry_observer_.RemoveAll(); | 469 extension_registry_observer_.RemoveAll(); |
| 470 | 470 |
| 471 // The tab strip should not have any tabs at this point. | 471 // The tab strip should not have any tabs at this point. |
| 472 DCHECK(tab_strip_model_->empty()); | 472 DCHECK(tab_strip_model_->empty()); |
| 473 tab_strip_model_->RemoveObserver(this); | 473 tab_strip_model_->RemoveObserver(this); |
| 474 bubble_manager_.reset(); |
| 474 | 475 |
| 475 // Destroy the BrowserCommandController before removing the browser, so that | 476 // Destroy the BrowserCommandController before removing the browser, so that |
| 476 // it doesn't act on any notifications that are sent as a result of removing | 477 // it doesn't act on any notifications that are sent as a result of removing |
| 477 // the browser. | 478 // the browser. |
| 478 command_controller_.reset(); | 479 command_controller_.reset(); |
| 479 BrowserList::RemoveBrowser(this); | 480 BrowserList::RemoveBrowser(this); |
| 480 | 481 |
| 481 SessionService* session_service = | 482 SessionService* session_service = |
| 482 SessionServiceFactory::GetForProfile(profile_); | 483 SessionServiceFactory::GetForProfile(profile_); |
| 483 if (session_service) | 484 if (session_service) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 if (OkToCloseWithInProgressDownloads(&num_downloads) == | 543 if (OkToCloseWithInProgressDownloads(&num_downloads) == |
| 543 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && | 544 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN && |
| 544 !browser_defaults::kBrowserAliveWithNoWindows) { | 545 !browser_defaults::kBrowserAliveWithNoWindows) { |
| 545 DownloadService::CancelAllDownloads(); | 546 DownloadService::CancelAllDownloads(); |
| 546 } | 547 } |
| 547 } | 548 } |
| 548 | 549 |
| 549 /////////////////////////////////////////////////////////////////////////////// | 550 /////////////////////////////////////////////////////////////////////////////// |
| 550 // Getters & Setters | 551 // Getters & Setters |
| 551 | 552 |
| 553 ChromeBubbleManager* Browser::GetBubbleManager() { |
| 554 if (!bubble_manager_) |
| 555 bubble_manager_.reset(new ChromeBubbleManager(tab_strip_model_.get())); |
| 556 return bubble_manager_.get(); |
| 557 } |
| 558 |
| 552 FindBarController* Browser::GetFindBarController() { | 559 FindBarController* Browser::GetFindBarController() { |
| 553 if (!find_bar_controller_.get()) { | 560 if (!find_bar_controller_.get()) { |
| 554 FindBar* find_bar = window_->CreateFindBar(); | 561 FindBar* find_bar = window_->CreateFindBar(); |
| 555 find_bar_controller_.reset(new FindBarController(find_bar)); | 562 find_bar_controller_.reset(new FindBarController(find_bar)); |
| 556 find_bar->SetFindBarController(find_bar_controller_.get()); | 563 find_bar->SetFindBarController(find_bar_controller_.get()); |
| 557 find_bar_controller_->ChangeWebContents( | 564 find_bar_controller_->ChangeWebContents( |
| 558 tab_strip_model_->GetActiveWebContents()); | 565 tab_strip_model_->GetActiveWebContents()); |
| 559 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect()); | 566 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect()); |
| 560 } | 567 } |
| 561 return find_bar_controller_.get(); | 568 return find_bar_controller_.get(); |
| (...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2656 if (contents && !allow_js_access) { | 2663 if (contents && !allow_js_access) { |
| 2657 contents->web_contents()->GetController().LoadURL( | 2664 contents->web_contents()->GetController().LoadURL( |
| 2658 target_url, | 2665 target_url, |
| 2659 content::Referrer(), | 2666 content::Referrer(), |
| 2660 ui::PAGE_TRANSITION_LINK, | 2667 ui::PAGE_TRANSITION_LINK, |
| 2661 std::string()); // No extra headers. | 2668 std::string()); // No extra headers. |
| 2662 } | 2669 } |
| 2663 | 2670 |
| 2664 return contents != NULL; | 2671 return contents != NULL; |
| 2665 } | 2672 } |
| OLD | NEW |