// Activate the tab in the chrome UI, by tab id
18818
func (auto *AutoGcd) ActivateTabById(id string) error {
	tab, err := auto.tabById(id)
	if err != nil {
		return err
	}
	return auto.ActivateTab(tab)
}
779892
func (auto *AutoGcd) NewTab() (*Tab, error) {
	target, err := auto.debugger.NewTab()
	if err != nil {
		return nil, &InvalidTabErr{Message: "unable to create tab: " + err.Error()}
	}
	auto.tabLock.Lock()
	defer auto.tabLock.Unlock()

	tab, err := open(target)
	if err != nil {
		return nil, err
	}
	auto.tabs[target.Target.Id] = tab
	return tab, nil
}
666546
func open(target *gcd.ChromeTarget) (*Tab, error) {
	t := &Tab{ChromeTarget: target}
	t.eleMutex = &sync.RWMutex{}
	t.elements = make(map[int]*Element)
	t.nodeChange = make(chan *NodeChangeEvent)
	t.navigationCh = make(chan int, 1)  // for signaling navigation complete
	t.docUpdateCh = make(chan struct{}) // wait for documentUpdate to be called during navigation
	t.crashedCh = make(chan string)     // reason the tab crashed/was disconnected.
	t.exitCh = make(chan struct{})
	t.navigationTimeout = 30 * time.Second // default 30 seconds for timeout
	t.elementTimeout = 5 * time.Second     // default 5 seconds for waiting for element.
	t.stabilityTimeout = 2 * time.Second   // default 2 seconds before we give up waiting for stability
	t.stableAfter = 300 * time.Millisecond // default 300 ms for considering the DOM stable
	t.domChangeHandler = nil

	// enable various debugger services
	if _, err := t.Page.Enable(); err != nil {
		return nil, err
	}

	if _, err := t.DOM.Enable(); err != nil {
		return nil, err
	}

	if _, err := t.Console.Enable(); err != nil {
		return nil, err
	}

	if _, err := t.Debugger.Enable(); err != nil {
		return nil, err
	}
	t.disconnectedHandler = t.defaultDisconnectedHandler
	t.subscribeEvents()
	go t.listenDebuggerEvents()
	return t, nil
}
32444
func (n *Notifier) activate() error {
	n.mu.Lock()
	defer n.mu.Unlock()

	for _, data := range n.buffer {
		if err := n.send(n.sub, data); err != nil {
			return err
		}
	}
	n.activated = true
	return nil
}
719034
func NewActivateTargetArgs(targetID ID) *ActivateTargetArgs {
	args := new(ActivateTargetArgs)
	args.TargetID = targetID
	return args
}
116715
func (mc MongoClient) IntervalActionById(id string) (contract.IntervalAction, error) {
	s := mc.getSessionCopy()
	defer s.Close()

	query, err := idToBsonM(id)
	if err != nil {
		return contract.IntervalAction{}, err
	}

	var action models.IntervalAction
	if err := s.DB(mc.database.Name).C(db.IntervalAction).Find(query).One(&action); err != nil {
		return contract.IntervalAction{}, errorMap(err)
	}
	return action.ToContract(), nil
}
99743
func (t *Tab) SetUserAgent(userAgent string) error {
	_, err := t.Network.SetUserAgentOverrideWithParams(&gcdapi.NetworkSetUserAgentOverrideParams{
		UserAgent: userAgent,
	})
	return err
}
208603
func (auto *AutoGcd) Start() error {
	if auto.settings.connectToInstance {
		auto.debugger.ConnectToInstance(auto.settings.chromeHost, auto.settings.chromePort)
	} else {
		auto.debugger.StartProcess(auto.settings.chromePath, auto.settings.userDir, auto.settings.chromePort)
	}

	tabs, err := auto.debugger.GetTargets()
	if err != nil {
		return err
	}
	auto.tabLock.Lock()
	for _, tab := range tabs {
		t, err := open(tab)
		if err != nil {
			return err
		}
		auto.tabs[tab.Target.Id] = t
	}
	auto.tabLock.Unlock()
	return nil
}
259693
func (s *State) Activate() {
	if s.active > 1 {
		return
	}

	atomic.StoreInt64(&s.active, 1)

	subs := s.engine.diffOnlySubs()

	//activate all the subroot states first so they can
	//do any population they want
	for _, ko := range subs {
		ko.Activate()
	}

	s.ro.Lock()

	if s.activator != nil {
		s.activator()
	}

	s.ro.Unlock()
}
1120400
func (s *InstanceInformation) SetActivationId(v string) *InstanceInformation {
	s.ActivationId = &v
	return s
}
1159272
func (api *API) Activate(args params.ModelArgs) error {
	model, release, err := api.getImportingModel(args)
	if err != nil {
		return errors.Trace(err)
	}
	defer release()

	if err := model.SetStatus(status.StatusInfo{Status: status.Available}); err != nil {
		return errors.Trace(err)
	}

	// TODO(fwereade) - need to validate binaries here.
	return model.SetMigrationMode(state.MigrationModeNone)
}
1214920
func (s *CreateAgentInput) SetActivationKey(v string) *CreateAgentInput {
	s.ActivationKey = &v
	return s
}
537905
func (t *Task) Activate(c context.Context, s dm.DepsServer) (*ActivatedTask, error) {
	newTok := model.MakeRandomToken(c, 32)
	_, err := s.ActivateExecution(c, &dm.ActivateExecutionReq{
		Auth: t.Auth, ExecutionToken: newTok})
	if err != nil {
		return nil, err
	}

	return &ActivatedTask{
		s,
		c,
		&dm.Execution_Auth{Id: t.Auth.Id, Token: newTok},
		t.Desc,
		t.State,
	}, nil
}
1242827
func StepmanActivate(collection, stepID, stepVersion, dir, ymlPth string) error {
	logLevel := log.GetLevel().String()
	args := []string{"--loglevel", logLevel, "activate", "--collection", collection,
		"--id", stepID, "--version", stepVersion, "--path", dir, "--copyyml", ymlPth}
	return command.RunCommand("stepman", args...)
}
829922
func (c *Gcd) GetFirstTab() (*ChromeTarget, error) {
	connectableTargets, err := c.getConnectableTargets()
	if err != nil {
		return nil, err
	}
	for _, tabTarget := range connectableTargets {
		if tabTarget.Type == "page" {
			return openChromeTarget(c.addr, tabTarget)
		}
	}
	return nil, ErrNoTabAvailable
}
545689
func (s *CreateActivationOutput) SetActivationId(v string) *CreateActivationOutput {
	s.ActivationId = &v
	return s
}
380979
func (s *CreateIPSetInput) SetActivate(v bool) *CreateIPSetInput {
	s.Activate = &v
	return s
}