| 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 "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 Shell* Shell::FromRenderViewHost(RenderViewHost* rvh) { | 82 Shell* Shell::FromRenderViewHost(RenderViewHost* rvh) { |
| 83 for (size_t i = 0; i < windows_.size(); ++i) { | 83 for (size_t i = 0; i < windows_.size(); ++i) { |
| 84 if (windows_[i]->web_contents() && | 84 if (windows_[i]->web_contents() && |
| 85 windows_[i]->web_contents()->GetRenderViewHost() == rvh) { | 85 windows_[i]->web_contents()->GetRenderViewHost() == rvh) { |
| 86 return windows_[i]; | 86 return windows_[i]; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 return NULL; | 89 return NULL; |
| 90 } | 90 } |
| 91 | 91 |
| 92 Shell* Shell::CreateNewWindow(content::BrowserContext* browser_context, | 92 Shell* Shell::CreateNewWindow(BrowserContext* browser_context, |
| 93 const GURL& url, | 93 const GURL& url, |
| 94 SiteInstance* site_instance, | 94 SiteInstance* site_instance, |
| 95 int routing_id, | 95 int routing_id, |
| 96 WebContents* base_web_contents) { | 96 WebContents* base_web_contents) { |
| 97 WebContents* web_contents = WebContents::Create( | 97 WebContents* web_contents = WebContents::Create( |
| 98 browser_context, | 98 browser_context, |
| 99 site_instance, | 99 site_instance, |
| 100 routing_id, | 100 routing_id, |
| 101 base_web_contents, | 101 base_web_contents, |
| 102 NULL); | 102 NULL); |
| 103 Shell* shell = CreateShell(web_contents); | 103 Shell* shell = CreateShell(web_contents); |
| 104 if (!url.is_empty()) | 104 if (!url.is_empty()) |
| 105 shell->LoadURL(url); | 105 shell->LoadURL(url); |
| 106 return shell; | 106 return shell; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void Shell::LoadURL(const GURL& url) { | 109 void Shell::LoadURL(const GURL& url) { |
| 110 web_contents_->GetController().LoadURL( | 110 web_contents_->GetController().LoadURL( |
| 111 url, | 111 url, |
| 112 content::Referrer(), | 112 Referrer(), |
| 113 content::PAGE_TRANSITION_TYPED, | 113 PAGE_TRANSITION_TYPED, |
| 114 std::string()); | 114 std::string()); |
| 115 web_contents_->Focus(); | 115 web_contents_->Focus(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void Shell::GoBackOrForward(int offset) { | 118 void Shell::GoBackOrForward(int offset) { |
| 119 web_contents_->GetController().GoToOffset(offset); | 119 web_contents_->GetController().GoToOffset(offset); |
| 120 web_contents_->Focus(); | 120 web_contents_->Focus(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void Shell::Reload() { | 123 void Shell::Reload() { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 Details<std::pair<NavigationEntry*, bool> >(details).ptr(); | 190 Details<std::pair<NavigationEntry*, bool> >(details).ptr(); |
| 191 | 191 |
| 192 if (title->first) { | 192 if (title->first) { |
| 193 string16 text = title->first->GetTitle(); | 193 string16 text = title->first->GetTitle(); |
| 194 PlatformSetTitle(text); | 194 PlatformSetTitle(text); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace content | 199 } // namespace content |
| OLD | NEW |