| 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 #ifndef CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 5 #ifndef CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
| 6 #define CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 6 #define CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 8 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 9 #include "base/win_util.h" | 12 #include "base/win_util.h" |
| 10 #include "chrome_frame/chrome_frame_automation.h" | 13 #include "chrome_frame/chrome_frame_automation.h" |
| 11 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/common/chrome_paths_internal.h" | 15 #include "chrome/common/chrome_paths_internal.h" |
| 13 #include "chrome_frame/simple_resource_loader.h" | 16 #include "chrome_frame/simple_resource_loader.h" |
| 14 #include "chrome_frame/utils.h" | 17 #include "chrome_frame/utils.h" |
| 15 | 18 |
| 16 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
| 17 | 20 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 automation_client_->Uninitialize(); | 57 automation_client_->Uninitialize(); |
| 55 automation_client_ = NULL; | 58 automation_client_ = NULL; |
| 56 } | 59 } |
| 57 } | 60 } |
| 58 | 61 |
| 59 bool InitializeAutomation(const std::wstring& profile_name, | 62 bool InitializeAutomation(const std::wstring& profile_name, |
| 60 const std::wstring& extra_chrome_arguments, | 63 const std::wstring& extra_chrome_arguments, |
| 61 bool incognito, bool is_widget_mode, | 64 bool incognito, bool is_widget_mode, |
| 62 const GURL& url, const GURL& referrer) { | 65 const GURL& url, const GURL& referrer) { |
| 63 DCHECK(IsValid()); | 66 DCHECK(IsValid()); |
| 67 DCHECK(launch_params_ == NULL); |
| 64 // We don't want to do incognito when privileged, since we're | 68 // We don't want to do incognito when privileged, since we're |
| 65 // running in browser chrome or some other privileged context. | 69 // running in browser chrome or some other privileged context. |
| 66 bool incognito_mode = !is_privileged_ && incognito; | 70 bool incognito_mode = !is_privileged_ && incognito; |
| 67 FilePath profile_path; | 71 FilePath profile_path; |
| 68 GetProfilePath(profile_name, &profile_path); | 72 GetProfilePath(profile_name, &profile_path); |
| 69 ChromeFrameLaunchParams chrome_launch_params = { | 73 launch_params_ = new ChromeFrameLaunchParams(url, referrer, profile_path, |
| 70 kCommandExecutionTimeout, | 74 profile_name, extra_chrome_arguments, incognito_mode, is_widget_mode); |
| 71 url, | 75 return automation_client_->Initialize(this, launch_params_); |
| 72 referrer, | |
| 73 profile_path, | |
| 74 profile_name, | |
| 75 extra_chrome_arguments, | |
| 76 true, | |
| 77 incognito_mode, | |
| 78 is_widget_mode | |
| 79 }; | |
| 80 return automation_client_->Initialize(this, chrome_launch_params); | |
| 81 } | 76 } |
| 82 | 77 |
| 83 // ChromeFrameDelegate implementation | 78 // ChromeFrameDelegate implementation |
| 84 virtual WindowType GetWindow() const { | 79 virtual WindowType GetWindow() const { |
| 85 return (static_cast<const T*>(this))->m_hWnd; | 80 return (static_cast<const T*>(this))->m_hWnd; |
| 86 } | 81 } |
| 87 | 82 |
| 88 virtual void GetBounds(RECT* bounds) { | 83 virtual void GetBounds(RECT* bounds) { |
| 89 if (bounds) { | 84 if (bounds) { |
| 90 if (::IsWindow(GetWindow())) { | 85 if (::IsWindow(GetWindow())) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 FilePath* profile_path) { | 228 FilePath* profile_path) { |
| 234 chrome::GetChromeFrameUserDataDirectory(profile_path); | 229 chrome::GetChromeFrameUserDataDirectory(profile_path); |
| 235 *profile_path = profile_path->Append(profile_name); | 230 *profile_path = profile_path->Append(profile_name); |
| 236 DLOG(INFO) << __FUNCTION__ << ": " << profile_path->value(); | 231 DLOG(INFO) << __FUNCTION__ << ": " << profile_path->value(); |
| 237 } | 232 } |
| 238 | 233 |
| 239 protected: | 234 protected: |
| 240 // Our gateway to chrome land | 235 // Our gateway to chrome land |
| 241 scoped_refptr<ChromeFrameAutomationClient> automation_client_; | 236 scoped_refptr<ChromeFrameAutomationClient> automation_client_; |
| 242 | 237 |
| 238 // How we launched Chrome. |
| 239 scoped_refptr<ChromeFrameLaunchParams> launch_params_; |
| 240 |
| 243 // Url of the containing document. | 241 // Url of the containing document. |
| 244 std::string document_url_; | 242 std::string document_url_; |
| 245 | 243 |
| 246 // We set this flag when we're taking the focus ourselves | 244 // We set this flag when we're taking the focus ourselves |
| 247 // and notifying the host browser that we're doing so. | 245 // and notifying the host browser that we're doing so. |
| 248 // When the flag is not set, we transfer the focus to chrome. | 246 // When the flag is not set, we transfer the focus to chrome. |
| 249 bool ignore_setfocus_; | 247 bool ignore_setfocus_; |
| 250 | 248 |
| 251 // The plugin is privileged if it is: | 249 // The plugin is privileged if it is: |
| 252 // * Invoked by a window running under the system principal in FireFox. | 250 // * Invoked by a window running under the system principal in FireFox. |
| 253 // * Being hosted by a custom host exposing the SID_ChromeFramePrivileged | 251 // * Being hosted by a custom host exposing the SID_ChromeFramePrivileged |
| 254 // service. | 252 // service. |
| 255 // | 253 // |
| 256 // When privileged, additional interfaces are made available to the user. | 254 // When privileged, additional interfaces are made available to the user. |
| 257 bool is_privileged_; | 255 bool is_privileged_; |
| 258 | 256 |
| 259 // List of functions to enable for automation, or a single entry "*" to | 257 // List of functions to enable for automation, or a single entry "*" to |
| 260 // enable all functions for automation. Ignored unless is_privileged_ is | 258 // enable all functions for automation. Ignored unless is_privileged_ is |
| 261 // true. Defaults to the empty list, meaning automation will not be | 259 // true. Defaults to the empty list, meaning automation will not be |
| 262 // turned on. | 260 // turned on. |
| 263 std::vector<std::string> functions_enabled_; | 261 std::vector<std::string> functions_enabled_; |
| 264 }; | 262 }; |
| 265 | 263 |
| 266 #endif // CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 264 #endif // CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
| 267 | 265 |
| OLD | NEW |