1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// IE toolband implementation.
#include "ceee/ie/plugin/toolband/tool_band.h"
#include <atlsafe.h>
#include <atlstr.h>
#include <shlguid.h>
#include "base/debug/trace_event.h"
#include "base/file_path.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "ceee/common/com_utils.h"
#include "ceee/common/window_utils.h"
#include "ceee/common/windows_constants.h"
#include "ceee/ie/common/extension_manifest.h"
#include "ceee/ie/common/ceee_module_util.h"
#include "ceee/ie/plugin/bho/tool_band_visibility.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/automation/automation_constants.h"
#include "chrome_frame/com_message_event.h"
_ATL_FUNC_INFO ToolBand::handler_type_idispatch_ =
{ CC_STDCALL, VT_EMPTY, 1, { VT_DISPATCH } };
_ATL_FUNC_INFO ToolBand::handler_type_long_ =
{ CC_STDCALL, VT_EMPTY, 1, { VT_I4 } };
_ATL_FUNC_INFO ToolBand::handler_type_idispatch_bstr_ =
{ CC_STDCALL, VT_EMPTY, 2, { VT_DISPATCH, VT_BSTR } };
_ATL_FUNC_INFO ToolBand::handler_type_bstr_i4_=
{ CC_STDCALL, VT_EMPTY, 2, { VT_BSTR, VT_I4 } };
_ATL_FUNC_INFO ToolBand::handler_type_bstrarray_=
{ CC_STDCALL, VT_EMPTY, 1, { VT_ARRAY | VT_BSTR } };
_ATL_FUNC_INFO ToolBand::handler_type_idispatch_variantref_ =
{ CC_STDCALL, VT_EMPTY, 2, { VT_DISPATCH, VT_VARIANT | VT_BYREF } };
ToolBand::ToolBand()
: already_tried_installing_(false),
own_line_flag_(false),
already_checked_own_line_flag_(false),
listening_to_browser_events_(false),
band_id_(0),
is_quitting_(false),
current_width_(64),
current_height_(25) {
TRACE_EVENT_BEGIN("ceee.toolband", this, "");
}
ToolBand::~ToolBand() {
TRACE_EVENT_END("ceee.toolband", this, "");
}
HRESULT ToolBand::FinalConstruct() {
return S_OK;
}
void ToolBand::FinalRelease() {
}
STDMETHODIMP ToolBand::SetSite(IUnknown* site) {
typedef IObjectWithSiteImpl<ToolBand> SuperSite;
// From experience we know the site may be set multiple times.
// Let's ignore second and subsequent set or unset.
if (NULL != site && NULL != m_spUnkSite.p ||
NULL == site && NULL == m_spUnkSite.p) {
// TODO(siggi@chromium.org) log this.
return S_OK;
}
if (NULL == site) {
// We're being torn down.
Teardown();
}
HRESULT hr = SuperSite::SetSite(site);
if (FAILED(hr))
return hr;
if (NULL != site) {
// We're being initialized.
hr = Initialize(site);
// Release the site in case of failure.
if (FAILED(hr))
SuperSite::SetSite(NULL);
}
return hr;
}
STDMETHODIMP ToolBand::ShowDW(BOOL show) {
ShowWindow(show ? SW_SHOW : SW_HIDE);
if (show) {
// Report that the toolband is being shown, so that the BHO
// knows it doesn't need to explicitly make it visible.
ToolBandVisibility::ReportToolBandVisible(web_browser_);
}
// Unless ShowDW changes are explicitly being ignored (e.g. if the
// BHO is forcing the toolband to be visible via
// ShowBrowserBar), or unless the toolband is closing on quit, then we assume
// a call to ShowDW reflects the user's toolband visibility choice, modifiable
// through the View -> Toolbars menu in IE. We track this choice here.
if (!ceee_module_util::GetIgnoreShowDWChanges() && !is_quitting_) {
ceee_module_util::SetOptionToolbandIsHidden(show == FALSE);
}
return S_OK;
}
STDMETHODIMP ToolBand::CloseDW(DWORD reserved) {
// Indicates to ShowDW() that the tool band is being closed, as opposed to
// being explicitly hidden by the user.
is_quitting_ = true;
return ShowDW(FALSE);
}
STDMETHODIMP ToolBand::ResizeBorderDW(LPCRECT border,
IUnknown* toolband_site,
BOOL reserved) {
DCHECK(FALSE); // Not used for toolbands.
return E_NOTIMPL;
}
STDMETHODIMP ToolBand::GetBandInfo(DWORD band_id,
DWORD view_mode,
DESKBANDINFO* deskband_info) {
band_id_ = band_id;
// We're only registered as a horizontal band.
DCHECK(view_mode == DBIF_VIEWMODE_NORMAL);
if (!deskband_info)
return E_POINTER;
if (deskband_info->dwMask & DBIM_MINSIZE) {
deskband_info->ptMinSize.x = current_width_;
deskband_info->ptMinSize.y = current_height_;
}
if (deskband_info->dwMask & DBIM_MAXSIZE) {
deskband_info->ptMaxSize.x = -1;
deskband_info->ptMaxSize.y = -1;
}
if (deskband_info->dwMask & DBIM_INTEGRAL) {
deskband_info->ptIntegral.x = 1;
deskband_info->ptIntegral.y = 1;
}
if (deskband_info->dwMask & DBIM_ACTUAL) {
// By not setting, we just use the default.
// deskband_info->ptActual.x = 7000;
deskband_info->ptActual.y = current_height_;
}
if (deskband_info->dwMask & DBIM_TITLE) {
// Title is empty.
deskband_info->wszTitle[0] = 0;
}
if (deskband_info->dwMask & DBIM_MODEFLAGS) {
deskband_info->dwModeFlags = DBIMF_NORMAL /* | DBIMF_TOPALIGN */;
if (ShouldForceOwnLine()) {
deskband_info->dwModeFlags |= DBIMF_BREAK;
}
}
if (deskband_info->dwMask & DBIM_BKCOLOR) {
// Use the default background color by removing this flag.
deskband_info->dwMask &= ~DBIM_BKCOLOR;
}
return S_OK;
}
STDMETHODIMP ToolBand::GetWindow(HWND* window) {
*window = m_hWnd;
return S_OK;
}
STDMETHODIMP ToolBand::ContextSensitiveHelp(BOOL enter_mode) {
LOG(INFO) << "ContextSensitiveHelp";
return E_NOTIMPL;
}
STDMETHODIMP ToolBand::GetClassID(CLSID* clsid) {
*clsid = GetObjectCLSID();
return S_OK;
}
STDMETHODIMP ToolBand::IsDirty() {
return S_FALSE; // Never dirty for now.
}
STDMETHODIMP ToolBand::Load(IStream* stream) {
return S_OK; // Loading is no-op.
}
STDMETHODIMP ToolBand::Save(IStream* stream, BOOL clear_dirty) {
return S_OK; // Saving is no-op.
}
STDMETHODIMP ToolBand::GetSizeMax(ULARGE_INTEGER* size) {
size->QuadPart = 0ULL; // We're frugal.
return S_OK;
}
STDMETHODIMP ToolBand::GetWantsPrivileged(boolean* wants_privileged) {
*wants_privileged = true;
return S_OK;
}
STDMETHODIMP ToolBand::GetChromeExtraArguments(BSTR* args) {
DCHECK(args);
// Extra arguments are passed on verbatim, so we add the -- prefix.
CComBSTR str = "--";
str.Append(switches::kEnableExperimentalExtensionApis);
*args = str.Detach();
return S_OK;
}
STDMETHODIMP ToolBand::GetChromeProfileName(BSTR* profile_name) {
*profile_name = ::SysAllocString(
ceee_module_util::GetBrokerProfileNameForIe());
return S_OK;
}
STDMETHODIMP ToolBand::GetExtensionApisToAutomate(BSTR* functions_enabled) {
*functions_enabled = NULL;
return S_FALSE;
}
STDMETHODIMP ToolBand::ShouldShowVersionMismatchDialog() {
// Only the toolband shows the warning dialog, meaning it gets shown once
// per tab.
return S_OK;
}
HRESULT ToolBand::Initialize(IUnknown* site) {
TRACE_EVENT_INSTANT("ceee.toolband.initialize", this, "");
CComQIPtr<IServiceProvider> service_provider = site;
DCHECK(service_provider);
if (service_provider == NULL) {
return E_FAIL;
}
HRESULT hr = InitializeAndShowWindow(site);
if (FAILED(hr)) {
LOG(ERROR) << "Toolband failed to initalize its site window: " <<
com::LogHr(hr);
return hr;
}
// Store the web browser, used to report toolband visibility to
// the BHO. Also required to get navigate2 notification.
hr = service_provider->QueryService(
SID_SWebBrowserApp, IID_IWebBrowser2,
reinterpret_cast<void**>(&web_browser_));
DCHECK(SUCCEEDED(hr));
if (FAILED(hr)) {
LOG(ERROR) << "Failed to get web browser: 0x" << std::hex << hr;
return hr;
} else if (ShouldForceOwnLine()) {
// This may seem odd, but event subscription is required
// only to clear 'own line' flag later (see OnIeNavigateComplete2)
hr = HostingBrowserEvents::DispEventAdvise(web_browser_,
&DIID_DWebBrowserEvents2);
listening_to_browser_events_ = SUCCEEDED(hr);
DCHECK(SUCCEEDED(hr)) <<
"DispEventAdvise on web browser failed. Error: " << hr;
// Non-critical functionality. If fails in the field, just move on.
}
return S_OK;
}
HRESULT ToolBand::InitializeAndShowWindow(IUnknown* site) {
CComPtr<IOleWindow> site_window;
HRESULT hr = site->QueryInterface(&site_window);
if (FAILED(hr)) {
LOG(ERROR) << "Failed to get site window: " << com::LogHr(hr);
return hr;
}
DCHECK(NULL != site_window.p);
hr = site_window->GetWindow(&parent_window_.m_hWnd);
if (FAILED(hr)) {
LOG(ERROR) << "Failed to get parent window handle: " << com::LogHr(hr);
return hr;
}
DCHECK(parent_window_);
if (!parent_window_)
return E_FAIL;
if (NULL == Create(parent_window_))
return E_FAIL;
BOOL shown = ShowWindow(SW_SHOW);
DCHECK(shown);
return hr;
}
HRESULT ToolBand::Teardown() {
TRACE_EVENT_INSTANT("ceee.toolband.teardown", this, "");
if (IsWindow()) {
// Teardown the ActiveX host window.
CAxWindow host(m_hWnd);
CComPtr<IObjectWithSite> host_with_site;
HRESULT hr = host.QueryHost(&host_with_site);
if (SUCCEEDED(hr))
host_with_site->SetSite(NULL);
DestroyWindow();
}
if (chrome_frame_) {
ChromeFrameEvents::DispEventUnadvise(chrome_frame_);
}
if (web_browser_ && listening_to_browser_events_) {
HostingBrowserEvents::DispEventUnadvise(web_browser_,
&DIID_DWebBrowserEvents2);
}
listening_to_browser_events_ = false;
return S_OK;
}
void ToolBand::OnFinalMessage(HWND window) {
GetUnknown()->Release();
}
LRESULT ToolBand::OnCreate(LPCREATESTRUCT lpCreateStruct) {
// Grab a self-reference.
GetUnknown()->AddRef();
// Create a host window instance.
CComPtr<IAxWinHostWindow> host;
HRESULT hr = CAxHostWindow::CreateInstance(&host);
if (FAILED(hr)) {
LOG(ERROR) << "Failed to create ActiveX host window. " << com::LogHr(hr);
return 1;
}
// We're the site for the host window, this needs to be in place
// before we attach ChromeFrame to the ActiveX control window, so
// as to allow it to probe our service provider.
hr = SetChildSite(host);
DCHECK(SUCCEEDED(hr));
// Create the chrome frame instance.
hr = chrome_frame_.CoCreateInstance(L"ChromeTab.ChromeFrame");
if (FAILED(hr)) {
LOG(ERROR) << "Failed to create the Chrome Frame instance. " <<
com::LogHr(hr);
return 1;
}
// And attach it to our window.
hr = host->AttachControl(chrome_frame_, m_hWnd);
if (FAILED(hr)) {
LOG(ERROR) << "Failed to attach Chrome Frame to the host. " <<
com::LogHr(hr);
return 1;
}
// Hook up the chrome frame event listener.
hr = ChromeFrameEvents::DispEventAdvise(chrome_frame_);
if (FAILED(hr)) {
LOG(ERROR) << "Failed to hook up event sink. " << com::LogHr(hr);
}
return 0;
}
void ToolBand::OnPaint(CDCHandle dc) {
RECT rc = {};
if (GetUpdateRect(&rc, FALSE)) {
PAINTSTRUCT ps = {};
BeginPaint(&ps);
BOOL ret = GetClientRect(&rc);
DCHECK(ret);
CString text;
text.Format(L"Google CEEE. No Chrome Frame found. Instance: 0x%p. ID: %d!)",
this, band_id_);
::DrawText(ps.hdc, text, -1, &rc, DT_SINGLELINE | DT_BOTTOM | DT_CENTER);
EndPaint(&ps);
}
}
void ToolBand::OnSize(UINT type, CSize size) {
LOG(INFO) << "ToolBand::OnSize(" << type << ", "
<< size.cx << "x" << size.cy << ")";
CWindow chrome_window = ::GetWindow(m_hWnd, GW_CHILD);
if (!chrome_window) {
LOG(ERROR) << "Failed to retrieve Chrome Frame window";
return;
}
BOOL resized = chrome_window.ResizeClient(size.cx, size.cy);
DCHECK(resized);
}
STDMETHODIMP_(void) ToolBand::OnCfReadyStateChanged(LONG state) {
DLOG(INFO) << "OnCfReadyStateChanged(" << state << ")";
if (state == READYSTATE_COMPLETE) {
extension_path_ = ceee_module_util::GetExtensionPath();
if (ceee_module_util::IsCrxOrEmpty(extension_path_) &&
ceee_module_util::NeedToInstallExtension()) {
LOG(INFO) << "Installing extension: \"" << extension_path_ << "\"";
chrome_frame_->installExtension(CComBSTR(extension_path_.c_str()));
} else {
// In the case where we don't have a CRX (or we don't need to install it),
// we must ask for the currently enabled extension before we can decide
// what we need to do.
chrome_frame_->getEnabledExtensions();
}
}
}
STDMETHODIMP_(void) ToolBand::OnCfMessage(IDispatch* event) {
VARIANT origin = {VT_NULL};
HRESULT hr = event->Invoke(ComMessageEvent::DISPID_MESSAGE_EVENT_ORIGIN,
IID_NULL, 0, DISPATCH_PROPERTYGET, 0, &origin, 0, 0);
if (FAILED(hr) || origin.vt != VT_BSTR) {
DLOG(WARNING) << __FUNCTION__ << ": unable to discern message origin.";
return;
}
VARIANT data_bstr = {VT_NULL};
hr = event->Invoke(ComMessageEvent::DISPID_MESSAGE_EVENT_DATA,
IID_NULL, 0, DISPATCH_PROPERTYGET, 0, &data_bstr, 0, 0);
if (FAILED(hr) || data_bstr.vt != VT_BSTR) {
DLOG(INFO) << __FUNCTION__ << ": no message data. Origin:"
<< origin.bstrVal;
return;
}
DLOG(INFO) << __FUNCTION__ << ": Origin: " << origin.bstrVal
<< ", Data: " << data_bstr.bstrVal;
CString data(data_bstr);
// Handle CEEE-specific messages.
// TODO(skare@google.com): If we will need this for more than one
// message, consider making responses proper JSON.
// ceee_getCurrentWindowId: chrome.windows.getCurrent workaround.
CString message;
if (data == L"ceee_getCurrentWindowId") {
HWND browser_window = 0;
web_browser_->get_HWND(reinterpret_cast<long*>(&browser_window));
bool is_ieframe = window_utils::IsWindowClass(browser_window,
windows::kIeFrameWindowClass);
if (is_ieframe) {
message.Format(L"ceee_getCurrentWindowId %d", browser_window);
} else {
DCHECK(is_ieframe);
LOG(WARNING) << "Could not find IE Frame window.";
message = L"ceee_getCurrentWindowId -1";
}
}
if (!message.IsEmpty()) {
chrome_frame_->postMessage(CComBSTR(message), origin);
}
}
void ToolBand::StartExtension(const wchar_t* base_dir) {
if (!LoadManifestFile(base_dir, &extension_url_)) {
LOG(ERROR) << "No extension found";
} else {
HRESULT hr = chrome_frame_->put_src(CComBSTR(extension_url_.c_str()));
DCHECK(SUCCEEDED(hr));
LOG_IF(WARNING, FAILED(hr)) << "IChromeFrame::put_src returned: " <<
com::LogHr(hr);
}
}
STDMETHODIMP_(void) ToolBand::OnCfExtensionReady(BSTR path, int response) {
TRACE_EVENT_INSTANT("ceee.toolband.oncfextensionready", this, "");
if (ceee_module_util::IsCrxOrEmpty(extension_path_)) {
// If we get here, it's because we just did the first-time
// install, so save the installation path+time for future comparison.
ceee_module_util::SetInstalledExtensionPath(
FilePath(extension_path_));
}
// Now list enabled extensions so that we can properly start it whether
// it's a CRX file or an exploded folder.
//
// Note that we do this even if Chrome says installation failed,
// as that is the error code it uses when we try to install an
// older version of the extension than it already has, which happens
// on overinstall when Chrome has already auto-updated.
//
// If it turns out no extension is installed, we will handle that
// error in the OnCfGetEnabledExtensionsComplete callback.
chrome_frame_->getEnabledExtensions();
}
STDMETHODIMP_(void) ToolBand::OnCfGetEnabledExtensionsComplete(
SAFEARRAY* extension_directories) {
CComSafeArray<BSTR> directories;
directories.Attach(extension_directories); // MUST DETACH BEFORE RETURNING
// TODO(joi@chromium.org) Handle multiple extensions.
if (directories.GetCount() > 0) {
// If our extension_path is not a CRX, it MUST be the same as the installed
// extension path which would be an exploded extension.
// If you get this DCHECK, you may have changed your registry settings to
// debug with an exploded extension, but you didn't uninstall the previous
// extension, either via the Chrome UI or by simply wiping out your
// profile folder.
DCHECK(ceee_module_util::IsCrxOrEmpty(extension_path_) ||
extension_path_ == std::wstring(directories.GetAt(0)));
StartExtension(directories.GetAt(0));
} else if (!ceee_module_util::IsCrxOrEmpty(extension_path_)) {
// We have an extension path that isn't a CRX and we don't have any
// enabled extension, so we must load the exploded extension from this
// given path. WE MUST DO THIS BEFORE THE NEXT ELSE IF because it assumes
// a CRX file.
chrome_frame_->loadExtension(CComBSTR(extension_path_.c_str()));
} else if (!already_tried_installing_ && !extension_path_.empty()) {
// We attempt to install the .crx file from the CEEE folder; in the
// default case this will happen only once after installation.
// It may seem redundant with OnCfReadyStateChanged; this is in case the
// user deleted the extension but the registry stayed the same.
already_tried_installing_ = true;
chrome_frame_->installExtension(CComBSTR(extension_path_.c_str()));
} else {
// Hide the browser bar as fast as we can.
// Set the current height of the bar to 0, so that if the user manually
// shows the bar, it will not be visible on screen.
current_height_ = 0;
// Ask IE to reload all info for this toolband.
CComPtr<IOleCommandTarget> cmd_target;
HRESULT hr = GetSite(IID_IOleCommandTarget,
reinterpret_cast<void**>(&cmd_target));
if (SUCCEEDED(hr)) {
CComVariant band_id(static_cast<int>(band_id_));
hr = cmd_target->Exec(&CGID_DeskBand, DBID_BANDINFOCHANGED,
OLECMDEXECOPT_DODEFAULT, &band_id, NULL);
if (FAILED(hr)) {
LOG(ERROR) << "Failed to Execute DBID_BANDINFOCHANGED. Error Code: "
<< com::LogHr(hr);
}
} else {
LOG(ERROR) << "Failed to obtain OleCommandTarget. Error Code: "
<< com::LogHr(hr);
}
}
directories.Detach();
}
STDMETHODIMP_(void) ToolBand::OnIeNavigateComplete2(IDispatch* dispatch,
VARIANT* url) {
// The flag is cleared on navigation complete since at this point we are
// certain the process of placing the toolband has been completed.
// Doing it in GetBandInfo proved premature as many queries are expeced.
ClearForceOwnLineFlag();
// We need to clear that flag just once. Now that's done, unadvise.
DCHECK(web_browser_ != NULL);
if (web_browser_ && listening_to_browser_events_) {
HostingBrowserEvents::DispEventUnadvise(web_browser_,
&DIID_DWebBrowserEvents2);
listening_to_browser_events_ = false;
}
}
bool ToolBand::LoadManifestFile(const std::wstring& base_dir,
std::string* toolband_url) {
DCHECK(toolband_url);
FilePath toolband_extension_path;
toolband_extension_path = FilePath(base_dir);
if (toolband_extension_path.empty()) {
// Expected case if no extensions registered/found.
return false;
}
ExtensionManifest manifest;
HRESULT hr = manifest.ReadManifestFile(toolband_extension_path, true);
if (FAILED(hr)) {
LOG(ERROR) << "Failed to read manifest at \"" <<
toolband_extension_path.value() << "\", error " << com::LogHr(hr);
return false;
}
const std::vector<std::string>& toolstrip_names(
manifest.GetToolstripFileNames());
if (!toolstrip_names.empty()) {
*toolband_url = "chrome-extension://";
*toolband_url += manifest.extension_id();
*toolband_url += "/";
// TODO(mad@chromium.org): For now we only load the first one we
// find, we may want to stack them at one point...
*toolband_url += toolstrip_names[0];
}
return true;
}
bool ToolBand::ShouldForceOwnLine() {
if (!already_checked_own_line_flag_) {
own_line_flag_ = ceee_module_util::GetOptionToolbandForceReposition();
already_checked_own_line_flag_ = true;
}
return own_line_flag_;
}
void ToolBand::ClearForceOwnLineFlag() {
if (own_line_flag_ || !already_checked_own_line_flag_) {
own_line_flag_ = false;
already_checked_own_line_flag_ = true;
ceee_module_util::SetOptionToolbandForceReposition(false);
}
}
|