Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: chrome_frame/turndown_prompt/turndown_prompt.cc

Issue 113143006: Add base:: to string16 in chrome_frame/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test_utils.cc ('k') | chrome_frame/turndown_prompt/turndown_prompt_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame/turndown_prompt/turndown_prompt.h" 5 #include "chrome_frame/turndown_prompt/turndown_prompt.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <shlguid.h> 8 #include <shlguid.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 25 matching lines...) Expand all
36 void OnUninstallClicked(UrlLauncher* url_launcher); 36 void OnUninstallClicked(UrlLauncher* url_launcher);
37 37
38 // Manages the Turndown UI in response to browsing ChromeFrame-rendered 38 // Manages the Turndown UI in response to browsing ChromeFrame-rendered
39 // pages. 39 // pages.
40 class BrowserObserver : public ReadyModeWebBrowserAdapter::Observer { 40 class BrowserObserver : public ReadyModeWebBrowserAdapter::Observer {
41 public: 41 public:
42 BrowserObserver(IWebBrowser2* web_browser, 42 BrowserObserver(IWebBrowser2* web_browser,
43 ReadyModeWebBrowserAdapter* adapter); 43 ReadyModeWebBrowserAdapter* adapter);
44 44
45 // ReadyModeWebBrowserAdapter::Observer implementation 45 // ReadyModeWebBrowserAdapter::Observer implementation
46 virtual void OnNavigateTo(const string16& url); 46 virtual void OnNavigateTo(const base::string16& url);
47 virtual void OnRenderInChromeFrame(const string16& url); 47 virtual void OnRenderInChromeFrame(const base::string16& url);
48 virtual void OnRenderInHost(const string16& url); 48 virtual void OnRenderInHost(const base::string16& url);
49 49
50 private: 50 private:
51 // Shows the turndown prompt. 51 // Shows the turndown prompt.
52 void ShowPrompt(); 52 void ShowPrompt();
53 void Hide(); 53 void Hide();
54 // Returns a self-managed pointer that is not guaranteed to survive handling 54 // Returns a self-managed pointer that is not guaranteed to survive handling
55 // of Windows events. For safety's sake, retrieve this pointer for each use 55 // of Windows events. For safety's sake, retrieve this pointer for each use
56 // and do not store it for use outside of scope. 56 // and do not store it for use outside of scope.
57 InfobarManager* GetInfobarManager(); 57 InfobarManager* GetInfobarManager();
58 58
59 GURL rendered_url_; 59 GURL rendered_url_;
60 base::win::ScopedComPtr<IWebBrowser2> web_browser_; 60 base::win::ScopedComPtr<IWebBrowser2> web_browser_;
61 ReadyModeWebBrowserAdapter* adapter_; 61 ReadyModeWebBrowserAdapter* adapter_;
62 62
63 DISALLOW_COPY_AND_ASSIGN(BrowserObserver); 63 DISALLOW_COPY_AND_ASSIGN(BrowserObserver);
64 }; 64 };
65 65
66 // Implements launching of a URL in an instance of IWebBrowser2. 66 // Implements launching of a URL in an instance of IWebBrowser2.
67 class UrlLauncherImpl : public UrlLauncher { 67 class UrlLauncherImpl : public UrlLauncher {
68 public: 68 public:
69 explicit UrlLauncherImpl(IWebBrowser2* web_browser); 69 explicit UrlLauncherImpl(IWebBrowser2* web_browser);
70 70
71 // UrlLauncher implementation 71 // UrlLauncher implementation
72 void LaunchUrl(const string16& url); 72 void LaunchUrl(const base::string16& url);
73 73
74 private: 74 private:
75 base::win::ScopedComPtr<IWebBrowser2> web_browser_; 75 base::win::ScopedComPtr<IWebBrowser2> web_browser_;
76 }; 76 };
77 77
78 UrlLauncherImpl::UrlLauncherImpl(IWebBrowser2* web_browser) { 78 UrlLauncherImpl::UrlLauncherImpl(IWebBrowser2* web_browser) {
79 DCHECK(web_browser); 79 DCHECK(web_browser);
80 web_browser_ = web_browser; 80 web_browser_ = web_browser;
81 } 81 }
82 82
83 void UrlLauncherImpl::LaunchUrl(const string16& url) { 83 void UrlLauncherImpl::LaunchUrl(const base::string16& url) {
84 VARIANT flags = { VT_I4 }; 84 VARIANT flags = { VT_I4 };
85 V_I4(&flags) = navOpenInNewWindow; 85 V_I4(&flags) = navOpenInNewWindow;
86 base::win::ScopedBstr location(url.c_str()); 86 base::win::ScopedBstr location(url.c_str());
87 87
88 HRESULT hr = web_browser_->Navigate(location, &flags, NULL, NULL, NULL); 88 HRESULT hr = web_browser_->Navigate(location, &flags, NULL, NULL, NULL);
89 DLOG_IF(ERROR, FAILED(hr)) << "Failed to invoke Navigate on IWebBrowser2. " 89 DLOG_IF(ERROR, FAILED(hr)) << "Failed to invoke Navigate on IWebBrowser2. "
90 << "Error: " << hr; 90 << "Error: " << hr;
91 } 91 }
92 92
93 BrowserObserver::BrowserObserver(IWebBrowser2* web_browser, 93 BrowserObserver::BrowserObserver(IWebBrowser2* web_browser,
94 ReadyModeWebBrowserAdapter* adapter) 94 ReadyModeWebBrowserAdapter* adapter)
95 : web_browser_(web_browser), 95 : web_browser_(web_browser),
96 adapter_(adapter) { 96 adapter_(adapter) {
97 } 97 }
98 98
99 void BrowserObserver::OnNavigateTo(const string16& url) { 99 void BrowserObserver::OnNavigateTo(const base::string16& url) {
100 if (!net::registry_controlled_domains::SameDomainOrHost( 100 if (!net::registry_controlled_domains::SameDomainOrHost(
101 GURL(url), 101 GURL(url),
102 rendered_url_, 102 rendered_url_,
103 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) { 103 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
104 rendered_url_ = GURL(); 104 rendered_url_ = GURL();
105 Hide(); 105 Hide();
106 } 106 }
107 } 107 }
108 108
109 void BrowserObserver::OnRenderInChromeFrame(const string16& url) { 109 void BrowserObserver::OnRenderInChromeFrame(const base::string16& url) {
110 ShowPrompt(); 110 ShowPrompt();
111 rendered_url_ = GURL(url); 111 rendered_url_ = GURL(url);
112 } 112 }
113 113
114 void BrowserObserver::OnRenderInHost(const string16& url) { 114 void BrowserObserver::OnRenderInHost(const base::string16& url) {
115 Hide(); 115 Hide();
116 rendered_url_ = GURL(url); 116 rendered_url_ = GURL(url);
117 } 117 }
118 118
119 void BrowserObserver::ShowPrompt() { 119 void BrowserObserver::ShowPrompt() {
120 // This pointer is self-managed and not guaranteed to survive handling of 120 // This pointer is self-managed and not guaranteed to survive handling of
121 // Windows events. For safety's sake, retrieve this pointer for each use and 121 // Windows events. For safety's sake, retrieve this pointer for each use and
122 // do not store it for use outside of scope. 122 // do not store it for use outside of scope.
123 InfobarManager* infobar_manager = GetInfobarManager(); 123 InfobarManager* infobar_manager = GetInfobarManager();
124 124
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // See if the prompt is explicitly suppressed via GP. 278 // See if the prompt is explicitly suppressed via GP.
279 return PolicySettings::GetInstance()->suppress_turndown_prompt(); 279 return PolicySettings::GetInstance()->suppress_turndown_prompt();
280 } 280 }
281 281
282 void Configure(IWebBrowser2* web_browser) { 282 void Configure(IWebBrowser2* web_browser) {
283 if (!IsPromptSuppressed()) 283 if (!IsPromptSuppressed())
284 InstallPrompts(web_browser); 284 InstallPrompts(web_browser);
285 } 285 }
286 286
287 } // namespace turndown_prompt 287 } // namespace turndown_prompt
OLDNEW
« no previous file with comments | « chrome_frame/test_utils.cc ('k') | chrome_frame/turndown_prompt/turndown_prompt_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698