| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 2712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2723 } | 2723 } |
| 2724 | 2724 |
| 2725 return contents; | 2725 return contents; |
| 2726 } | 2726 } |
| 2727 | 2727 |
| 2728 bool Browser::CanDuplicateContentsAt(int index) { | 2728 bool Browser::CanDuplicateContentsAt(int index) { |
| 2729 NavigationController& nc = GetWebContentsAt(index)->GetController(); | 2729 NavigationController& nc = GetWebContentsAt(index)->GetController(); |
| 2730 return nc.GetWebContents() && nc.GetLastCommittedEntry(); | 2730 return nc.GetWebContents() && nc.GetLastCommittedEntry(); |
| 2731 } | 2731 } |
| 2732 | 2732 |
| 2733 void Browser::DuplicateContentsAt(int index) { | 2733 TabContents* Browser::DuplicateContentsAt(int index) { |
| 2734 TabContents* contents = GetTabContentsAt(index); | 2734 TabContents* contents = GetTabContentsAt(index); |
| 2735 CHECK(contents); | 2735 CHECK(contents); |
| 2736 TabContents* contents_dupe = contents->Clone(); | 2736 TabContents* contents_dupe = contents->Clone(); |
| 2737 | 2737 |
| 2738 bool pinned = false; | 2738 bool pinned = false; |
| 2739 if (CanSupportWindowFeature(FEATURE_TABSTRIP)) { | 2739 if (CanSupportWindowFeature(FEATURE_TABSTRIP)) { |
| 2740 // If this is a tabbed browser, just create a duplicate tab inside the same | 2740 // If this is a tabbed browser, just create a duplicate tab inside the same |
| 2741 // window next to the tab being duplicated. | 2741 // window next to the tab being duplicated. |
| 2742 int index = tab_strip_model_->GetIndexOfTabContents(contents); | 2742 int index = tab_strip_model_->GetIndexOfTabContents(contents); |
| 2743 pinned = IsTabPinned(index); | 2743 pinned = IsTabPinned(index); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2769 browser->window()->Show(); | 2769 browser->window()->Show(); |
| 2770 | 2770 |
| 2771 // The page transition below is only for the purpose of inserting the tab. | 2771 // The page transition below is only for the purpose of inserting the tab. |
| 2772 browser->AddTab(contents_dupe, content::PAGE_TRANSITION_LINK); | 2772 browser->AddTab(contents_dupe, content::PAGE_TRANSITION_LINK); |
| 2773 } | 2773 } |
| 2774 | 2774 |
| 2775 SessionService* session_service = | 2775 SessionService* session_service = |
| 2776 SessionServiceFactory::GetForProfileIfExisting(profile_); | 2776 SessionServiceFactory::GetForProfileIfExisting(profile_); |
| 2777 if (session_service) | 2777 if (session_service) |
| 2778 session_service->TabRestored(contents_dupe, pinned); | 2778 session_service->TabRestored(contents_dupe, pinned); |
| 2779 return contents_dupe; |
| 2779 } | 2780 } |
| 2780 | 2781 |
| 2781 void Browser::CloseFrameAfterDragSession() { | 2782 void Browser::CloseFrameAfterDragSession() { |
| 2782 #if !defined(OS_MACOSX) | 2783 #if !defined(OS_MACOSX) |
| 2783 // This is scheduled to run after we return to the message loop because | 2784 // This is scheduled to run after we return to the message loop because |
| 2784 // otherwise the frame will think the drag session is still active and ignore | 2785 // otherwise the frame will think the drag session is still active and ignore |
| 2785 // the request. | 2786 // the request. |
| 2786 // TODO(port): figure out what is required here in a cross-platform world | 2787 // TODO(port): figure out what is required here in a cross-platform world |
| 2787 MessageLoop::current()->PostTask( | 2788 MessageLoop::current()->PostTask( |
| 2788 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); | 2789 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); |
| (...skipping 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5230 if (contents && !allow_js_access) { | 5231 if (contents && !allow_js_access) { |
| 5231 contents->web_contents()->GetController().LoadURL( | 5232 contents->web_contents()->GetController().LoadURL( |
| 5232 target_url, | 5233 target_url, |
| 5233 content::Referrer(), | 5234 content::Referrer(), |
| 5234 content::PAGE_TRANSITION_LINK, | 5235 content::PAGE_TRANSITION_LINK, |
| 5235 std::string()); // No extra headers. | 5236 std::string()); // No extra headers. |
| 5236 } | 5237 } |
| 5237 | 5238 |
| 5238 return contents != NULL; | 5239 return contents != NULL; |
| 5239 } | 5240 } |
| OLD | NEW |